Go Back   PCMech Forums > Help & Discussion > Web Design / Development

Need Some Help? Type Your Keywords Here:

Reply
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
Old 01-01-2004, 03:06 AM   #1
Member (6 bit)
 
Join Date: Oct 2003
Location: New Zealand
Posts: 58
SQL Help

Hi
I am new to SQL and when using the
'select * from whatever where columnname = whatever'
can I have 2 of the 'where' parts

So instead of having 1 condition like here, can I have 2 conditions?

Thank you

Last edited by jasontung; 01-01-2004 at 03:23 AM.
jasontung is offline   Reply With Quote
Old 01-01-2004, 11:32 AM   #2
Member (7 bit)
 
Join Date: Aug 2002
Posts: 64
hi,
sure you can have many conditions like:

select *
from customer
where state = 'NJ'
and id = 123

just keep using the AND keyword to add another condition to the where clause.
Sony is offline   Reply With Quote
Old 01-01-2004, 03:34 PM   #3
Member (6 bit)
 
Join Date: Oct 2003
Location: New Zealand
Posts: 58
OK, Thank you for the relpy
jasontung is offline   Reply With Quote
Old 01-01-2004, 04:44 PM   #4
Professional gadfly
 
doctorgonzo's Avatar
 
Join Date: Jan 2002
Location: Minneapolis, MN
Posts: 6,364
Send a message via MSN to doctorgonzo
You can have as many as you want, connecting AND, OR and NOT. You can usually use things like BETWEEN as well, depending on the implementation. Use parentheses to make things clear.

In some of the queries I have constructed, I have lots of where clauses, such as selecting all the people whose addresses start with this and who ordered between these to dates and who haven't received their order yet but have paid. That kind of thing.
doctorgonzo is offline   Reply With Quote
Old 01-02-2004, 04:50 AM   #5
Member (6 bit)
 
Join Date: Oct 2003
Location: New Zealand
Posts: 58
Thank you
I see now
jasontung is offline   Reply With Quote
Reply

Bookmarks

Still Need Help? Type Your Keywords Here:


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -5. The time now is 12:44 AM.
Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2012, vBulletin Solutions, Inc.
SEO by vBSEO 3.6.0 PL2