Hi,
I am new to SQL programming. Please help.
I would like to select all the Month count in 3/2005, 4/2005, 5/2005 from this table:
ID Start End
1 3/1/2005 3/31/2005
1 4/1/2005 4/30/2005
1 5/1/2005 5/31/2005
2 2/1/2003 Null
3 3/1/2005 4/30/2005
4 3/1/2005 6/30/2005
I want the result to be as follow:
ID MonthCountFeb_May
1 3
2 3
4 3
Record with ID=3 is not include because it doesn't cover the period between 3/2005-5/2005.
Is this sound like a good solution?
1. Copy to new table
2. Update Begin column to 3/1/2005 if <=3/1/2005
3. Update End column to 5/31/2005 if null or >=5/31/2005
4. Create new column call MonthCount
5. update MonthCount=?????
Any help would be appreciate.
I am new to SQL programming. Please help.
I would like to select all the Month count in 3/2005, 4/2005, 5/2005 from this table:
ID Start End
1 3/1/2005 3/31/2005
1 4/1/2005 4/30/2005
1 5/1/2005 5/31/2005
2 2/1/2003 Null
3 3/1/2005 4/30/2005
4 3/1/2005 6/30/2005
I want the result to be as follow:
ID MonthCountFeb_May
1 3
2 3
4 3
Record with ID=3 is not include because it doesn't cover the period between 3/2005-5/2005.
Is this sound like a good solution?
1. Copy to new table
2. Update Begin column to 3/1/2005 if <=3/1/2005
3. Update End column to 5/31/2005 if null or >=5/31/2005
4. Create new column call MonthCount
5. update MonthCount=?????
Any help would be appreciate.