Hi Patrice

I would try some brackets.

Something like this should work

SELECT * FROM listings WHERE listing_state = 'DC' AND listings.listing_show ='y' AND ( listings.cat1 = 23 OR listings.cat2 = 23 OR listings.cat3 = 23 )

Mike


----- Original Message ----- From: "Biz-comm" <b...@biz-comm.com>
To: <mysql@lists.mysql.com>
Sent: Monday, January 02, 2012 10:33 AM
Subject: Beginner question


Thanks for any assistance.

Web page that needs a sort of all records with a specific state, set to "show", and if it exists in one of 4 categories.


Using this:

SELECT *
FROM listings
WHERE listing_state = 'DC'
AND listings.listing_show ='y'
AND  listings.cat1 = 23  OR listings.cat2 = 23 OR listings.cat3 = 23


Gives up 2 records in the state of DC, set to show, and are listed in cat1.

However, it also gives up 2 records in the state of VA, set to show, but are listed in cat2 (not in 1).

Any assistance most appreciated.



Regards,

Patrice Olivier-Wilson
828-628-0500
http://Biz-comm.com
b...@biz-comm.com





--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/mysql


--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/mysql

Reply via email to