Created
October 30, 2012 18:11
-
-
Save iammart/3981967 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
| $query = @mysql_query(" | |
| SELECT pm.id, pv.id AS variation_id, pm.title, pm.vat_exempt, pm.thumbimage, MIN(pv.price) AS from_price, pv.price | |
| FROM ( | |
| SELECT id, title, thumbimage, vat_exempt FROM products_main | |
| WHERE is_log_token != 'Y' | |
| AND is_report_token != 'Y' | |
| AND enabled = 'Y' | |
| AND viewable = 'Y' | |
| ORDER BY `id` DESC LIMIT 1 | |
| ) AS pm | |
| INNER JOIN product_variations AS pv ON (pm.id = pv.product_id) | |
| WHERE pv.product_id = pm.id AND pv.is_hire_product = 'N' | |
| "); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You did it with the sub select?