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 2005 Forums
 Transact-SQL (2005)
 query help

Author  Topic 

cruxmagi
Starting Member

38 Posts

Posted - 2009-01-27 : 21:57:54
I have resultset like this
Monday,January 19 2009-01-19 00:00:00.000 24 brushing true mas 2
Monday,January 19 2009-01-19 00:00:00.000 30 Reading news paper 2
Monday,January 19 2009-01-19 00:00:00.000 31 Reading news paper 2
Monday,January 19 2009-01-19 00:00:00.000 32 Reading news paper 2
Monday,January 19 2009-01-19 00:00:00.000 32 Reading news paper 2
i want my o/p will be like this
Monday,January 19 2009-01-19 00:00:00.000 24 brushing true mas 2
Monday,January 19 2009-01-19 00:00:00.000 30 Reading news paper 2
Monday,January 19 2009-01-19 00:00:00.000 31 Reading news paper 2
Monday,January 19 2009-01-19 00:00:00.000 32 Reading news paper 2
when i use group by it throws an error,i d't want to select the duplicate taskId.Could you help me out

AvanthaSiriwardana
Yak Posting Veteran

78 Posts

Posted - 2009-01-27 : 22:02:34
group by taskid and date

Avantha Siriwardana
Go to Top of Page

cruxmagi
Starting Member

38 Posts

Posted - 2009-01-27 : 22:06:06
table structure
Date TaskDate TaskId TaskName Status
Monday,January 19 2009-01-19 00:00:00.000 24 brushing true mas 2
Monday,January 19 2009-01-19 00:00:00.000 30 Reading news paper 2
Monday,January 19 2009-01-19 00:00:00.000 31 Reading news paper 2
Monday,January 19 2009-01-19 00:00:00.000 32 Reading news paper 2
Monday,January 19 2009-01-19 00:00:00.000 32 Reading news paper 2

Go to Top of Page

cruxmagi
Starting Member

38 Posts

Posted - 2009-01-27 : 22:07:38
quote:
Originally posted by AvanthaSiriwardana

group by taskid and date

Avantha Siriwardana


it throws an error
Go to Top of Page

sodeep
Master Smack Fu Yak Hacker

7174 Posts

Posted - 2009-01-27 : 22:33:01
[code]Select distinct [Date], TaskDate ,TaskId, TaskName ,Status
from table[/code]
Go to Top of Page

cruxmagi
Starting Member

38 Posts

Posted - 2009-01-27 : 22:40:56
quote:
Originally posted by sodeep

Select distinct [Date], TaskDate ,TaskId, TaskName ,Status
from table



Thanks a lot.it worked out
Go to Top of Page

sodeep
Master Smack Fu Yak Hacker

7174 Posts

Posted - 2009-01-27 : 22:41:50
Welcome .
Go to Top of Page
   

- Advertisement -