r0xette r0xette - 3 months ago 31
SQL Question

mysql table structure with multiple variables

I am writing a script which will counts the number of ticket as per as different conditions and store the count in a summary table. I am unable to understand how to structure my table since there will be more than 1 variables.

enter image description here

The script will run every week and with each execution a new week will be added. Once the new month starts and scripts execute, a new month will be added and once new year starts a new year will be added. So in a nutshell I have columns which are also variables. Not sure how to handle it and structure my db.


Have columns Date Service Count.

Like so.

Date            Service      Count
16 May 2016     Service1     35

Then when you go to display them in the report pivot them as you want. Probably better to make date an INT and either an auto number PK or composite PK of Date and Service.