Warning: Creating default object from empty value in /www/htdocs/v030397/mysql-qotd/wp-content/plugins/sitepress-multilingual-cms/sitepress.class.php on line 4991

Warning: Creating default object from empty value in /www/htdocs/v030397/mysql-qotd/wp-content/plugins/sitepress-multilingual-cms/sitepress.class.php on line 4993
Uncommon SQL 3 – MySQL Question of the Day

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.