On Sat, Feb 17, 2007 at 07:21:40PM +0100, M.P.Dankoor wrote:
> Louis-David Mitterrand wrote:
> >
> I thought of another solution, actually it's of those top n query tricks
> that I picked up somewhere, can't remember
> where.
> Assuming that your table is called shows, the following query should
> give you the results you want (hope so)
>
> SELECT *
> FROM shows a
> WHERE 3 > (SELECT COUNT(*)
> FROM shows b
> WHERE b.created_on >= a.created_on
> and a.show_type = b.show_type)
This is stunning and it works!
I can barely understand the query: it's so terse it hurts :)
/me goes back studying it
Thanks a lot!