I'm sure this is SQL-101 but I can't figure it out nor can I come up with the correct verbiage to find any useful results in web searches.
Example table:
id ext nr
289979 111-000-1002 529
392959 111-000-1002 NULL
449707 111-000-1002 335
400151 999-555-1212 NULL
456902 999-555-1212 NULL
471001 999-555-1212 NULL
I am trying to format a query to return the ext
if the nr
on all rows is NULL
so the query would return 999-555-1212
but not 111-000-1002
.
Is this what you want?
select ext
from t
group by ext
having max(nr) is null;
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.