Hi
I have a table with the following columns: Site_Serial, HSI_Year, HSI_Month and Weekly_Average. The latter three columns contain number fields rather than text.
What I need to do is return the Weekly Averages for a certain month, the most recent being April 2011, which is HSI_Year=2011 and HSI_Month=4.
I need to add a nested query to the following SQL query:
The reason I need a nested query is that I only want to return a row for April 2011 where there was also a weekly average for March 2011 (HSI_Year=2011 and HSI_Month=3) for the same site serial. I know I may need to use IS NOT NULL but I'm not sure how to nest this into my current query.Code:SELECT Site_Serial, HSI_Year, HSI_Month, Weekly_Average FROM tbl_SiteSerialsAndWeeklyAverages WHERE HSI_Year=2011 AND HSI_Month=4
Any help would be greatly appreciated, either the exact query or just help with the syntax.
Thanks
James