Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > PHP/MySQL > MySQL
Password Reminder
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
MySQL General discussion about the MySQL database.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the MySQL section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old March 25th, 2004, 09:05 PM
Registered User
Join Date: Mar 2004
Location: , , .
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default More than 1 WHERE clause?

I need to pick selections from a table, but I have two criteria to meet and am not sure how to do it:

1) The id needs to match a variable:
    "SELECT DISTINCT city_id FROM location WHERE master_id = $siteid"
2) The id needs not to be blank - some of the entries for it may be left blank, but gathering the blank entries creates an error, so I need to have a:
     "...WHERE master_id != "

Is there a way that I can SELECT depending on two different WHEREs?

Thanks much!


Reply With Quote
  #2 (permalink)  
Old March 26th, 2004, 01:48 PM
aas aas is offline
Authorized User
Join Date: Mar 2004
Location: Moscow, , Russia.
Posts: 26
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to aas

Do try as this

"... WHERE ltrim(master_id) = $siteid"


"... WHERE nvl(ltrim(master_id),'*') = $siteid"

Reply With Quote

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Case in Where Clause acko SQL Server 2000 12 September 12th, 2011 01:43 PM
date between clause mateenmohd Access 2 January 7th, 2008 09:28 AM
SQL Where Clause sudarshan73 Crystal Reports 2 January 11th, 2006 10:01 AM
Order by clause mateenmohd SQL Server 2000 4 April 6th, 2004 06:48 AM
HAVING clause Adam H-W SQL Server ASP 2 February 11th, 2004 01:37 PM

All times are GMT -4. The time now is 04:40 AM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.