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)
 Msg 102, Level 15, State 1, Line 5

Author  Topic 

djcraig
Starting Member

1 Post

Posted - 2009-07-15 : 16:13:14
I'm running a simpe query (at least I thought it was simple):
select max(vote_date)
from
(select ca.vote_date from concept_approvers ca
union
select ia.vote_date from investment_approvers ia)

I 'm getting the following error:
Msg 102, Level 15, State 1, Line 5
Incorrect syntax near ')'.

Any help is appreciated

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2009-07-15 : 16:32:01
select max(vote_date)
from
(select ca.vote_date from concept_approvers ca
union
select ia.vote_date from investment_approvers ia) as dt

You have to give an alias for a derived table.



No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2009-07-16 : 14:07:45
since you're any ways taking only max value, it might be better to use union all inside as you dont need to look for distinct values inside
Go to Top of Page
   

- Advertisement -