|
I need your suggestion to write one tricky SQL query to select only one record from database on the following condition.I explained simple table structure below.I have a table temp with four columns a,b,c,d in it.
I have to select column d from this temp table based on the following four conditions.If it matches any condition, It should skip other conditions, that's the tricky thing.
Conditions order is like shown below.
1) a='argument1' and b='argument2' and c='argument3'(If it matches this condition, it should stop selecting below 3 conditions)
2) a='argument1' and b='argument2' and c='none'(If it matches this condition, it should stop selecting below 2 conditions)
3) a='argument1' and b='none' and c='argument3'(If it matches this condition, it should stop selecting below condition)
4) a='argument1' and b='none' and c='none'(this is last condition)
If I use OR operator , it matches all of those other conditions too.I never wrote query like this before.
I greatly appreciate if somebody sheds light on me to start writing this query with a simple suggestion.
Thanks,
GD
|