Need a handout on building a SQL query
Name A B C AA BB cc
--------------------------------------------------------
Name1 Data1 n Data3 3 n 15
Name2 n Data2 Data4 n 2 8
I want to select A, B, or C from a row only if AA, BB, or CC is not null.
So the end would appear:
select Name, A,B,c from table where ??? AA<10 and BB<10 and CC<10
^I know this is dumb, just to help you understand my goal.
Name A B C
-------------------------
Name1 Data1
Name2 Data2 Data4
Another example:
select Name, A,B,c from table where ??? AA<5 and BB<5 and CC<5
^I know this is dumb, just to help you understand my goal.
Name A B C
-------------------------
Name1 Data1
Name2 Data2
One more example, for kicks:
select Name, A,B,c from table where ??? AA<3 and BB<3 and CC<3
^I know this is dumb, just to help you understand my goal.
Name A B C
-------------------------
Name2 Data2
Thanks for reading!
No comments:
Post a Comment