Skip to content

Uncommon SQL 3

21. July 2010
By plogi in general

Hello!
The following query does the same than yesterday’s, featuring another syntax which isn’t used that often.

MariaDB [tt]> select * from vending_price
where (price,product_id) = any (select max(price),product_id
                                            from vending_price
                                            group by product_id);

The “ANY/ALL” syntax can be very intuitive for some queries… Unluckliy not for this example %)

Comment Feed

No Responses (yet)

You must be logged in to post a comment.