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 |
|
SP273
Starting Member
14 Posts |
Posted - 2011-02-24 : 14:52:49
|
| hi,I am trying to write following query & get the error:SELECT project from(select distinct Project from dbo.HS_Data_I UNION ALLselect distinct Project from dbo.HS_Data_II)I get the following error:Msg 102, Level 15, State 1, Line 4Incorrect syntax near ')'.Please let me know where i might be going wrong.Thanks! |
|
|
jimf
Master Smack Fu Yak Hacker
2875 Posts |
Posted - 2011-02-24 : 15:03:49
|
| You need to alias your tableSELECT project from(select distinct Project from dbo.HS_Data_I UNION ALLselect distinct Project from dbo.HS_Data_II) as newTable -- or whatever name you wish to give itJimEveryday I learn something that somebody else already knew |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2011-02-26 : 09:54:23
|
| if you want distinct values use UNION instead of UNION ALL and remove distincts on selects.------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
|
|
|