Created
March 22, 2016 02:37
-
-
Save mcloide/a971d50af6dda3a5e3b6 to your computer and use it in GitHub Desktop.
update-piratees
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 piratees p | |
join ( | |
select p1.id, min(ps.ship_in) as ship_in | |
from piratees p1 | |
join piratee_login ps on ps.piratee_id = p1.id | |
where ps.ship_in is not null | |
and ps.ship_in != '0000-00-00 00:00:00' | |
group by p1.id | |
) as ps | |
on ps.id = p.id | |
set p.start_date = ps.ship_in | |
where p.start_date = '0000-00-00' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment