Created
February 15, 2009 08:01
-
-
Save drogus/64643 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sql_attr_multi = uint feature_ids from query; \ | |
SELECT DISTINCT ON (feature_options.feature_id) restaurants.id, feature_options.id \ | |
FROM feature_options \ | |
INNER JOIN restaurant_feature_options ON feature_options.id = restaurant_feature_options.feature_option_id \ | |
INNER JOIN restaurants ON restaurants.id = restaurant_feature_options.restaurant_id \ | |
INNER JOIN features ON features.id = feature_options.feature_id \ | |
WHERE features.radio = 't' \ | |
ORDER BY feature_options.feature_id ASC, restaurant_feature_options.votes DESC; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment