Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 Syntax

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2002-04-24 : 10:40:32
Ori writes "I need help with the syntax.
i have 2 fileds - status and customer_name.
i want to retrive all the records with status bigger the 9 which their customer_name is "mmm" and all the records with status bigger the 20.
Tnx."

joldham
Wiseass Yak Posting Master

300 Posts

Posted - 2002-04-24 : 10:42:11
SELECT customer_name
FROM table
WHERE Status > 20
AND (status > 9
AND customer_name like 'mmm%'

Jeremy

Go to Top of Page

AjarnMark
SQL Slashing Gunting Master

3246 Posts

Posted - 2002-04-24 : 18:08:40
quote:

SELECT customer_name
FROM table
WHERE Status > 20
AND (status > 9
AND customer_name like 'mmm%'



Jeremy, shouldn't this be an OR?
SELECT customer_name
FROM table
WHERE Status > 20
OR (status > 9
AND customer_name like 'mmm%')

Go to Top of Page
   

- Advertisement -