Author |
Topic  |
|
Spoon
Average Member
  
Ireland
507 Posts |
Posted - 02 August 2001 : 09:35:11
|
Hi all,
How would make an sql stmt where you you searching with specific IDs. Eg. Select a name from Table name Users where U_ID is equal to 6, 10, 25, 11 etc? Is it like:
"Select U_NAME from USERS where U_ID=6 AND U_ID=10 AND U_ID=25 AND U_ID=11"
Could someone help me out??
Regards - Spoon
Begineer? Need help installing the forums? - www.aslickpage.com/snitz_help.html
www.ASlickPage.com - Private Messaging |
|
sogoth
New Member

United Kingdom
73 Posts |
Posted - 02 August 2001 : 09:38:47
|
Almost.
it would be SELECT U-NAME FROM USERS WHERE U_ID=10 OR U_ID=25 OR U_ID=6 OR U_ID=11
if you use AND it will not return anything as it tries to look for a record that has all those values
Paul - Complete Muppet, Borderline Feeble! |
 |
|
HuwR
Forum Admin
    
United Kingdom
20595 Posts |
Posted - 02 August 2001 : 11:27:16
|
depending on your database, you can use this also
SELECT U-NAME FROM USERS WHERE U_ID IN (10,25,6,11)
|
 |
|
Spoon
Average Member
  
Ireland
507 Posts |
Posted - 02 August 2001 : 14:08:26
|
quote:
depending on your database, you can use this also
SELECT U-NAME FROM USERS WHERE U_ID IN (10,25,6,11)
Thanks to both of you 
Regards - Spoon
Begineer? Need help installing the forums? - www.aslickpage.com/snitz_help.html
www.ASlickPage.com - Private Messaging |
 |
|
|
Topic  |
|