Created
June 21, 2009 22:16
-
-
Save wwalker/133682 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
select a.id, max(delivered_at) as last_delivery from alerts a join attempts at on at.alert_id = a.id group by a.id; | |
That select returns what I want to update alerts with. So I tried to write an update with GROUP and JOIN. | |
mysql> update alerts a join attempts att on att.alert_id = a.id set completed_at = max(delivered_at) group by a.id; | |
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'group by a.id' at line 1 | |
It failed.... | |
Can I do this update in SQL, or do I have to write a script in perl python or ruby? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment