SQL 2000 Query
-
I have a table with these fields: Season Day DateStart DateEnd WeekNumber MonthNumber MonthName Year S Sunday 2/1/2009 2/1/2009 1 1 February 2009 F Saturday 1/31/2009 1/31/2009 53 12 January 2009 . . . This is a daily fiscal calendar. I need to get the season, Day the season started, Date of the season start, Date of the season end, week number of season start, month name of season start, and the year of season start. Because this is daily calendar I am thinking I can get the MIN(DateStart), and WeekNumber grouped by WeekNumber and year. Season Date_Start Week_Number Month_Number Month Year S 2001-01-28 1 1 February 2001 S 2002-01-27 1 1 February 2002 S 2003-01-26 1 1 February 2003 S 2004-02-01 1 1 &nb
-
I have a table with these fields: Season Day DateStart DateEnd WeekNumber MonthNumber MonthName Year S Sunday 2/1/2009 2/1/2009 1 1 February 2009 F Saturday 1/31/2009 1/31/2009 53 12 January 2009 . . . This is a daily fiscal calendar. I need to get the season, Day the season started, Date of the season start, Date of the season end, week number of season start, month name of season start, and the year of season start. Because this is daily calendar I am thinking I can get the MIN(DateStart), and WeekNumber grouped by WeekNumber and year. Season Date_Start Week_Number Month_Number Month Year S 2001-01-28 1 1 February 2001 S 2002-01-27 1 1 February 2002 S 2003-01-26 1 1 February 2003 S 2004-02-01 1 1 &nb
Hi, Looking at your data, it seems that you have a single entry per year in both the min and max result sets. If so, you can use derived tables, something like:
Select ...
From
(
--your first (min) query
) as SeasonStart
Inner Join
(
--your second (max) query
) as SeasonEnd
on SeasonStart.Year = SeasonEnd.YearHope that helps. Regards,
Syed Mehroz Alam My Blog | My Articles
Computers are incredibly fast, accurate, and stupid; humans are incredibly slow, inaccurate and brilliant; together they are powerful beyond imagination. - Albert Einstein -
Hi, Looking at your data, it seems that you have a single entry per year in both the min and max result sets. If so, you can use derived tables, something like:
Select ...
From
(
--your first (min) query
) as SeasonStart
Inner Join
(
--your second (max) query
) as SeasonEnd
on SeasonStart.Year = SeasonEnd.YearHope that helps. Regards,
Syed Mehroz Alam My Blog | My Articles
Computers are incredibly fast, accurate, and stupid; humans are incredibly slow, inaccurate and brilliant; together they are powerful beyond imagination. - Albert EinsteinNo, that won't work because some fall seasons start in one year but end in a different year so the join won't work. Any other ideas?
CodingYoshi Artificial Intelligence is no match for Human Stupidity.