mysql - Find Rows Using Nested Count, Join, or Having -
i have data in table might so:
id | streetnum | name | item ----------------------------- 1 | 100 | | 0 2 | 100 | b | null 3 | 100 | c | null 4 | 101 | d | null 5 | 101 | e | null 6 | 102 | f | 1
i'm trying put query identify identical streenum's item column has both value , 1 or more null's. in example above, query's result should be:
100
my first instinct put nested query involving count(*) want see other ideas guys come with.
also possible self join:
select distinct streetnum atable a1,atable a2 a1.streetnum=a2.streenum , a1.item null , a2.item not null;
Comments
Post a Comment