Last active
January 24, 2018 16:00
Star
You must be signed in to star a gist
sql update from sub-query
This file contains 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
-- great way to batch update using a sub-query in the from clause | |
update category set catid=100 | |
from ( | |
select event.catid | |
from event | |
left join category cat on event.catid = cat.catid | |
where cat.catid is null | |
limit 1000 | |
) eventcat | |
where category.catid = eventcat.catid | |
and catgroup='Concerts'; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment