Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 How to Display Data Day Wise

Author  Topic 

real_pearl
Posting Yak Master

106 Posts

Posted - 2004-06-21 : 01:49:36
If I have to display data day wise what query should I write suppose

I have data

Program_ID, Program_Name, Finish_Date
1 A 01-04-2004
2 B 01-04-2004
3 C 02-04-2004
4 D 03-04-2004
5 E 06-04-2004

Now I want to display data as

Day Program_ID Program_Name
1 1 A
1 2 B
2 3 C
3 4 D
6 5 E

timmy
Master Smack Fu Yak Hacker

1242 Posts

Posted - 2004-06-21 : 01:51:50
SELECT Day(Finish_Date), Program_ID, Program_Name
FROM Table
Go to Top of Page

real_pearl
Posting Yak Master

106 Posts

Posted - 2004-06-21 : 02:09:41
IF I have to do the same task for week wise and fall each date in its proper week, what I may do. Please tell me.
Go to Top of Page

real_pearl
Posting Yak Master

106 Posts

Posted - 2004-06-21 : 02:09:55
IF I have to do the same task for week wise and fall each date in its proper week, what I may do. Please tell me.
Go to Top of Page

timmy
Master Smack Fu Yak Hacker

1242 Posts

Posted - 2004-06-21 : 02:45:19
Check out Books Online for the DatePart function.

There is a function to return the week number - DatePart(ww, <date>), but this returns the week number from the start of the year, not the month.

You could possibly use something like Floor(Day(Finish_Date) / 7), but this may not give you exactly what you need.

And please don't post the same question multiple times.....


Go to Top of Page
   

- Advertisement -