Snitz Forums 2000
Snitz Forums 2000
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Community Forums
 Code Support: ASP (Non-Forum Related)
 SQL stmt
 New Topic  Topic Locked
 Printer Friendly
Author Previous Topic Topic Next Topic  

Spoon
Average Member

Ireland
507 Posts

Posted - 02 August 2001 :  09:35:11  Show Profile  Visit Spoon's Homepage  Send Spoon an ICQ Message
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  Show Profile  Visit sogoth's Homepage
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!
Go to Top of Page

HuwR
Forum Admin

United Kingdom
20595 Posts

Posted - 02 August 2001 :  11:27:16  Show Profile  Visit HuwR's Homepage
depending on your database, you can use this also

SELECT U-NAME FROM USERS WHERE U_ID IN (10,25,6,11)





Go to Top of Page

Spoon
Average Member

Ireland
507 Posts

Posted - 02 August 2001 :  14:08:26  Show Profile  Visit Spoon's Homepage  Send Spoon an ICQ Message
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
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Topic Locked
 Printer Friendly
Jump To:
Snitz Forums 2000 © 2000-2021 Snitz™ Communications Go To Top Of Page
This page was generated in 0.34 seconds. Powered By: Snitz Forums 2000 Version 3.4.07