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 |
|
danielc
Starting Member
49 Posts |
Posted - 2006-07-21 : 13:10:09
|
| hello folks,i'm pretty green when it comes to SQL(matter of fact to everything) and have a question...I quite don't understand how this query was produced and would like some clarification... A nested query was used and in the nested query the user wrote 'select 1 and joined other tables'... My question is, how is the '1' used in the select statement?Thanks,Newbie... |
|
|
tonymorell10
Yak Posting Veteran
90 Posts |
Posted - 2006-07-21 : 13:26:28
|
| The 'select 1...' will just return the number 1 for every row retrieved by the query. It's often used in conjuntion with the EXISTS statement to test the existence of a result retuned by a query. |
 |
|
|
danielc
Starting Member
49 Posts |
Posted - 2006-07-21 : 13:33:25
|
| Hi Tony,Thanks for the reply... YOu are correct in the fact that the user did use the EXIST statement with 'select 1'... any idea where i can find literature on this, ie website? I would like to learn how to use that.Thanks againNewbie |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2006-07-22 : 02:36:26
|
| Usually you can use Select * or select 1 or any constant value when used with EXISTS. The result just says that row existsMadhivananFailing to plan is Planning to fail |
 |
|
|
|
|
|