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 2008 Forums
 Transact-SQL (2008)
 can i distinct columns?

Author  Topic 

sapator
Constraint Violating Yak Guru

462 Posts

Posted - 2014-12-09 : 06:46:47
[code]
select TransT_lgnNumber,TransT_dtmRealTransTime from tblTrans_Ticket
where TransT_strParentTType_strCode = '0177'
and TransT_dtmRealTransTime between '20130101' and '20130131'
group by TransT_lgnNumber
order by TransT_dtmRealTransTime
[/code]

This will have multiple columns as there are different dates.
Can i just select one date of these?Don't care what date, just one.
thanks.

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2014-12-09 : 08:52:07
select TransT_lgnNumber,MAX(TransT_dtmRealTransTime) as TransT_dtmRealTransTime from tblTrans_Ticket
where ...


Too old to Rock'n'Roll too young to die.
Go to Top of Page

sapator
Constraint Violating Yak Guru

462 Posts

Posted - 2014-12-09 : 09:47:26
Hi.
Yes max should do the trick.
Thanks.
Go to Top of Page
   

- Advertisement -