News for hackers. Stuff that matters.
Re:SQL as an API language by irishsultan on Friday October 05, 2018 @07:31AM (#18147261)
But that's equivalent to the following query which doesn't use having, only select

    select * from (select id, count(*) - 1 as nduplicates
       from parts where color = 'red'
       group by id) _inner
       where nduplicates > 0;

Now obviously that doesn't read as easily, but WHERE can filter out the count(*) perfectly.

There are no comments on this comment yet.