[SQL] exists and is not null equivalence in query

2009-05-28 Thread Raphael Bauduin
Hi, In some code I am taking over, I found this query: select count(t.trame_id) as count, v.voiture_num as voitureNum from arch_trames t left join voiture v on (v.tag_id=t.tag_id) where (t.recept_time >= 1243509320691) and exists (select v2.voiture_num from voiture v2 where v2.tag_id=v.tag_id)

Re: [SQL] exists and is not null equivalence in query

2009-05-28 Thread Tom Lane
Raphael Bauduin writes: > select count(t.trame_id) as count, v.voiture_num as voitureNum from > arch_trames t left join voiture v on (v.tag_id=t.tag_id) > where > (t.recept_time >= 1243509320691) > and exists (select v2.voiture_num from voiture v2 where v2.tag_id=v.tag_id) > group by v.voiture_