Subject | Help needed wit a Select ... Group By |
---|---|
Author | Nols Smit |
Post date | 2012-04-20T09:11:54Z |
Hi,
I have a case where I extract data with the following SQL:
Select Gender_Name, Race_Name, Fop_Name, count(ID) as Number_2008_2009 from V_Register_Fop
where RegStatus_ID = 1 and Register_RegDate >= '01.04.2008' and Register_RegDate <= '01.04.2009'
group by Gender_Name, Race_Name, Fop_Name
But then I have to execute the SQL again for the next bookyear up to the current one.
Is it posible to create one SQL select statement where I can have the result as:
GENDER_NAME, RACE_NAME, FOP_NAME, NUMBER_2008_2009, NUMBER_2009_2010, NUMBER_2010_2011, NUMBER_2011_2012
Regards,
Nols Smit
[Non-text portions of this message have been removed]
I have a case where I extract data with the following SQL:
Select Gender_Name, Race_Name, Fop_Name, count(ID) as Number_2008_2009 from V_Register_Fop
where RegStatus_ID = 1 and Register_RegDate >= '01.04.2008' and Register_RegDate <= '01.04.2009'
group by Gender_Name, Race_Name, Fop_Name
But then I have to execute the SQL again for the next bookyear up to the current one.
Is it posible to create one SQL select statement where I can have the result as:
GENDER_NAME, RACE_NAME, FOP_NAME, NUMBER_2008_2009, NUMBER_2009_2010, NUMBER_2010_2011, NUMBER_2011_2012
Regards,
Nols Smit
[Non-text portions of this message have been removed]