I am a newbie. Sorry if the question is stupid . I have a table as follows
A B C D
x 1
y 1
t z 1
my query is as follows:
Select D from table where A = 'x' OR B = 'y' OR C = 'n' EXCEPT Select D from table where (A NOT EQUALS 'x' AND A NOT EQUALS '')
OR (B NOT EQUALS 'y' AND B NOT EQUALS '')
OR (C NOT EQUALS 'n' AND C NOT EQUALS '')
The first query gives me 1,1 and the second gives me 1. Now I want the result to be 1,1 EXCEPT 1 i.e 1. However, SQL server removes all occurrences of 1 from the first result(which does make sense, but that's how my logic is right now).
Any kind of help would be highly appreciated.
A B C D
x 1
y 1
t z 1
my query is as follows:
Select D from table where A = 'x' OR B = 'y' OR C = 'n' EXCEPT Select D from table where (A NOT EQUALS 'x' AND A NOT EQUALS '')
OR (B NOT EQUALS 'y' AND B NOT EQUALS '')
OR (C NOT EQUALS 'n' AND C NOT EQUALS '')
The first query gives me 1,1 and the second gives me 1. Now I want the result to be 1,1 EXCEPT 1 i.e 1. However, SQL server removes all occurrences of 1 from the first result(which does make sense, but that's how my logic is right now).
Any kind of help would be highly appreciated.