Created
January 28, 2015 12:55
-
-
Save cyrilchampier/7986cbb016ee8e48c53f to your computer and use it in GitHub Desktop.
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
UPDATE users u | |
SET u.default_model3d_configuration = REPLACE(u.default_model3d_configuration, 'is_fit_to_view_computed: false', 'is_fit_to_view_computed: true') | |
WHERE EXISTS ( | |
SELECT * | |
FROM ( | |
SELECT m.owner_id, MAX(m.updated_at) updated_at | |
FROM model3ds m | |
GROUP BY m.owner_id | |
) AS owner_last_model | |
INNER JOIN model3ds m ON m.owner_id = owner_last_model.owner_id AND m.updated_at = owner_last_model.updated_at | |
INNER JOIN mod_display_configurations mdc ON m.id = mdc.model3d_id | |
WHERE mdc.is_fit_to_view_computed = true | |
AND m.owner_id = u.id | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment