Im trying to write a mysql query where I want to return a result of two possible out comes as in
select propType from sites where propType='$propType' or propType='*'
where propType=BB
I would want returned all results that would have BB in the propType column as well as * in the propType column.
Any ideas without having to make two queries to the db
phpScott
Return two results from same column
Moderator: General Moderators
take a look at 6.3.2.1 String Comparison Functions (mysql-manual)
you can use logical operands in WHERE clauses similar to PHP
SELECT .... WHERE cond1 OR cond2 is valid
you can use logical operands in WHERE clauses similar to PHP
SELECT .... WHERE cond1 OR cond2 is valid
- twigletmac
- Her Royal Site Adminness
- Posts: 5371
- Joined: Tue Apr 23, 2002 2:21 am
- Location: Essex, UK
You can also use the IN keyword (equivalent to lots of OR statements):
http://www.mysql.com/doc/en/Comparison_Operators.html
Mac
Code: Select all
SELECT propType FROM sites WHERE propType IN('$propType','*')Mac