SQL-query order by multiple columns having null values -
I found a table like this (note: there are more columns in the real table):
< Code> alley | Zip ----------- 'b' | 0 'A' 0 'c' | Null 'f' | 1 null | 0 null | NullI would like to do a query like this:
SELECT * from place ORDER by road, zip
The result of this query is:
road | ZIP ----------- 'a' | 0 'b' | 0 'c' | Null 'f' | 1 null | 0 Now the question is how should this output be produced (this is possible?):
alley | ZIP - ---------- 'a' | 0 'b' | 0 'c' | Null null | 0 'f' | 1 null | Null
If the value is zero of one column, it should be ignored / interpreted as a wildcard. I am using PostgreSQL 9.2.
Thank you for your help.
No, it does not seem possible that you can not create a copyable rule for that.
Your first example will also be valid if you behave as a wild card in futile behavior.
Road | ZIP --- -------- 'A' | 0 'b' | 0 'C' | Empty tap 0 tap Tap 'F' 1
will also be there.
Comments
Post a Comment