Using AND and OR together in sql



I've tried to make a search an AND OR query
eg

WHERE name='John' OR name='Paul' AND age='32'

However I keep getting the wrong results. The results I get are every
record with name of John or Paul of age 32 and simply name of John or Paul.

Can anyone show me the way this sql should be set.

PS

I've tried it with the brakets round the age='32' part but that didn't work
either.

Thanks for your replies
.



Relevant Pages

  • Re: Query question
    ... I would like to thank Paul and John for their good suggestions and add that if you have contacts in your directory you also want to add to the query or else you will be returning contacts as well as users. ... Joe Richards Microsoft MVP Windows Server Directory Services ... I would like to say thanks to Paul for his good suggestion. ... This query can find out all the users which do not belong to any of the three groups. ...
    (microsoft.public.windows.server.active_directory)
  • Re: Weight returning unexpected results
    ... John, thanks for your reply. ... although now I just ran the same query and I'm getting the results I ... I'll see if I can find anything in the BOL, ... Prev by Date: ...
    (microsoft.public.sqlserver.fulltext)
  • performance question/multiple keys
    ... The table I'm using has full-text columns and also a date column thats ... If I do a query on a date range and the full-text column does SQL ... John ... Prev by Date: ...
    (microsoft.public.sqlserver.fulltext)
  • Re: the greatest Beatle
    ... Boy, Danny, I really must have gotten you thinking!! ... the point of my previous posts was not to say Paul was ... better than John or John was better than Paul, ... Prev by Date: ...
    (rec.music.beatles)
  • Re: Hull sign Domic
    ... > Twas on ITV text a report in The Sun hence the ... Which Paul? ... John. ... Prev by Date: ...
    (rec.sport.rugby.league)

Loading