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
 General SQL Server Forums
 New to SQL Server Programming
 SELECT TOP query falls over

Author  Topic 

Rasta Pickles
Posting Yak Master

174 Posts

Posted - 2013-03-18 : 09:23:22
[code]
SELECT 'I', top 1
ActivityDate + cast(ActivityTime as datetime)
from FinancialActivity
order by ActivityDate desc, ActivityTime desc
[/code]

fails with invalid syntax?

How do I get output of I 18/03/2013 (not 18/03/2013 I)?

Thanks in advance.

bandi
Master Smack Fu Yak Hacker

2242 Posts

Posted - 2013-03-18 : 10:01:04
SELECT top 1 'I',
ActivityDate + cast(ActivityTime as datetime)
from FinancialActivity
order by ActivityDate desc, ActivityTime desc





--
Chandu
Go to Top of Page

Rasta Pickles
Posting Yak Master

174 Posts

Posted - 2013-03-18 : 10:09:33
Many thanks, ridiculously easy when you know how!
Go to Top of Page

bandi
Master Smack Fu Yak Hacker

2242 Posts

Posted - 2013-03-18 : 10:15:35
quote:
Originally posted by Rasta Pickles

Many thanks, ridiculously easy when you know how!


Any way... you sorted out...
Welcome

--
Chandu
Go to Top of Page
   

- Advertisement -