Wrox Programmer Forums
Go Back   Wrox Programmer Forums > PHP/MySQL > MySQL
| 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 software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #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!


  #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"

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

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