On Wednesday 16 January 2002 06:05, Andy wrote:
> Hi there,
>
> I am building a user search engine. Now I do not know how to gett
> following:
>
> a mandatory field and a voluntary field
>
> For example I would like to get all female users and those who are from
> canada.
> The results should show all users who are female regardless of nationality
> But it should also show all users from canada.
>
>
> How would this look like?
>
> SELECT *
> FROM table
> WHERE sex=1 AND country='CA'
>
> This is wrong I know. But how does it work???


SELECT * FROM TABLE
 WHERE sex = 1 OR country = 'CA';

Will select all users who are female as well as all users from Canada. You 
may get duplicate records (for people who are female and from Canada) so you 
may want to use DISTINCT as well.

hth
-- 
Jason Wong -> Gremlins Associates -> www.gremlins.com.hk

/*
Yeah, there are more important things in life than money, but they won't go
out with you if you don't have any.
*/

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to