February 4, 2010 at 7:29 pm
I HAVE A TABLE NAMED ORDERS WITH 3 COLUMNS, DATE, CLIENT AND CURRENCY
I NEED TO SELECT ALL RECORDS WHERE DATE IS NOT NULL, AND NEED TO SHOW THAT RESULT EXCEPT THE RECORDS THAT BELONGS TO TWO ESPECIFIC CLIENTS THAT CURRENCY = DOLARES. BUT I NEED TO SHOW THAT TWO CLIENTS IF THE CURRENCY = PESOS
FOR EXAMPLE THE TWO CLIENTS ARE X, Y
SELECT * FROM ORDERS WHERE DATE IS NOT NULL AND IF CLIENT IS X OR CLIENT IS Y SHOW ONLY IF CURRENCY = PESOS
BUT I DONT KNOW HOW TO DO THAT!!!!!
!"#$"#"!#%$
February 4, 2010 at 8:15 pm
Please provide a sample of how the expected output should look.
Jason...AKA CirqueDeSQLeil
_______________________________________________
I have given a name to my pain...MCM SQL Server, MVP
SQL RNNR
Posting Performance Based Questions - Gail Shaw[/url]
Learn Extended Events
February 5, 2010 at 12:23 am
If I understood your question properly, the following query will work:
SELECT * FROM ORDERS WHERE DATE IS NOT NULL
and (CLIENT not in ('X','Y')
or (CLIENT in ('X','Y') and CURRENCY = 'PESOS' ))
February 5, 2010 at 1:01 am
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply