Use solution in reply
Erik van Roon, July      18, 2016 - 6:20 am UTC
 
 
In fact, the solution in the reply isn't something you can 'also' do (implying the original one was good too) it's what you *should* do. 
Suppose you enter an extra record:
insert into t values('ab',null,'c'); 
Now the working query in he question produces wrong results.  
July      18, 2016 - 4:11 pm UTC 
 
Great point Erik, thanks for stopping by.