Hi Guys,
Sorry if this is a stupid question, I've been trying to figure out a way to achieve something and the more I think about it the more confused I get!!!
The scenario is that I work for a company that has 20 branches over three areas, each with a unique ID. At the end of each month the branch managers submit the total number of days that their employees have taken off sick in that month. I am trying to prepare a report for the company directors that shows the total amount of sickness throughout the company for any given month. This is simple enough, but the directors only want a months worth of figures to be available if each of the twenty stores have submitted their figures so that the results are not skewed.
I have a simple webform which allows the store managers to submit their figures for the month and I have a table which contains the month number (1 to 12), the year, the store code and the number of sick days.
My table is called store_check and has the following fields:
current_month - numeric
current_store - char(2)
current_year - char(4)
total_sickness - numeric
The stores are divided into three regions A, B and C and each store has a unique code eg. AA, AB, AC, AD, AE, AF, BA, BB, BC, BD etc..
Could anybody tell me how I can write a SQL statement to check to see if there is a row in the table for each of the 20 stores for month number 1 of year 2008?
Thanks in advance for any advice.
Sorry if this is a stupid question, I've been trying to figure out a way to achieve something and the more I think about it the more confused I get!!!
The scenario is that I work for a company that has 20 branches over three areas, each with a unique ID. At the end of each month the branch managers submit the total number of days that their employees have taken off sick in that month. I am trying to prepare a report for the company directors that shows the total amount of sickness throughout the company for any given month. This is simple enough, but the directors only want a months worth of figures to be available if each of the twenty stores have submitted their figures so that the results are not skewed.
I have a simple webform which allows the store managers to submit their figures for the month and I have a table which contains the month number (1 to 12), the year, the store code and the number of sick days.
My table is called store_check and has the following fields:
current_month - numeric
current_store - char(2)
current_year - char(4)
total_sickness - numeric
The stores are divided into three regions A, B and C and each store has a unique code eg. AA, AB, AC, AD, AE, AF, BA, BB, BC, BD etc..
Could anybody tell me how I can write a SQL statement to check to see if there is a row in the table for each of the 20 stores for month number 1 of year 2008?
Thanks in advance for any advice.

If you have a table with the store id in it, you could do a LEFT JOIN on that table with your store_check table and then count the number of NULLs in, say, the total_sickness column: