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 |
|
AskSQLTeam
Ask SQLTeam Question
0 Posts |
Posted - 2002-03-21 : 00:25:05
|
| sanjay writes "pl let me know the sql query for selecting only one (any) record out of a table that may contain n number of records...." |
|
|
Nazim
A custom title
1408 Posts |
Posted - 2002-03-21 : 00:32:03
|
| Sanjay your question is pretty vague. there are couple of ways of doing that , but which record are you looking for.eg:select top 1 * from tablenameorselect * from tablename where primarkeycol=somevalueHTH-------------------------------------------------------------- |
 |
|
|
tdodnz
Starting Member
23 Posts |
Posted - 2002-03-27 : 22:50:44
|
| What he means by this is that he has his database with a whole lot of results in it, he wants only one of them out of the amount there, like.Select tblUsers.Pops FROM tblUsers Where tblUsers.Pops >=5 ORDER BY DESCwhat hes after is so that out of that criteria he wants only 1 result, i am after the same thing |
 |
|
|
lgraz
Starting Member
7 Posts |
Posted - 2002-03-28 : 04:12:03
|
| Mmm...maybe withSelect TOP 1 tblUsers.Pops FROM tblUsers Where tblUsers.Pops >=5 ORDER BY DESC...or something like that?Just my 0.02€,LGraz |
 |
|
|
davidpardoe
Constraint Violating Yak Guru
324 Posts |
Posted - 2002-03-28 : 06:19:17
|
| Wow - another graz!============================Chairman of The NULL Appreciation Society"Keep NULLs as NULL" |
 |
|
|
|
|
|