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.
| Author |
Topic |
|
Mehala
Starting Member
7 Posts |
Posted - 2012-01-27 : 05:36:32
|
| Hi Friends,I need help, i need to write query group by date and in select query i need with date and time.can any one help me.Urgent plz.Meks |
|
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
Posted - 2012-01-27 : 05:40:40
|
If you are grouping 5 rows with the same date but they are different in the time part then ONE row is shown in the resultset instead of five rows!So how should it be possible to display FIVE different time parts in only ONE row? No, you're never too old to Yak'n'Roll if you're too young to die. |
 |
|
|
Mehala
Starting Member
7 Posts |
Posted - 2012-01-27 : 05:44:23
|
| my problem is same thing i can i solve it.suggest me some thing.Meks |
 |
|
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
Posted - 2012-01-27 : 05:50:44
|
You can show the min and the max as columns in that select/result.Try this:selectdateadd(d,datediff(d,0,YourDateTimeCol),0) as [Date],max(YourDateTimeCol) as MaxDate,min(YourDateTimeCol) as MinDate,count(*) as Cntfrom YourTablegroup by dateadd(d,datediff(d,0,YourDateTimeCol),0) No, you're never too old to Yak'n'Roll if you're too young to die. |
 |
|
|
Mehala
Starting Member
7 Posts |
Posted - 2012-01-27 : 06:33:03
|
| Thanks for your reply.problem solvedMeks |
 |
|
|
|
|
|
|
|