Last active
August 29, 2015 14:03
-
-
Save figure002/7487a97808a870f41804 to your computer and use it in GitHub Desktop.
Eliminating subqueries
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
-- How to eliminate the following sub queries? | |
INSERT INTO photos_tags (photo_id, tag_id) VALUES (?, (SELECT id FROM tags WHERE name=?)); | |
-- Becomes: | |
INSERT INTO photos_tags (photo_id, tag_id) SELECT ?, id FROM tags WHERE name=?; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment