You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As a hedge against errors, find any legislator who has the same district ID as another one and expire the older of the two legislators, setting date_ended to the day prior to the new legislator's date_started.
The text was updated successfully, but these errors were encountered:
Something like this may do it. This gets a list of every legislator whose date_ended is null, whose record was created more than 10 days ago, and who shares a district ID with a legislator whose record was created less than 10 days ago.
SELECTr1.name, r1.idFROM representatives AS r1
WHEREr1.date_ended IS NULLANDr1.date_created< NOW() - INTERVAL 10 DAY ANDr1.district_id=
(SELECTr2.district_idFROM representatives AS r2
WHEREr2.district_id=r1.district_idAND date_created BETWEEN CURDATE() - INTERVAL 10 DAY AND CURDATE())
As a hedge against errors, find any legislator who has the same district ID as another one and expire the older of the two legislators, setting
date_ended
to the day prior to the new legislator'sdate_started
.The text was updated successfully, but these errors were encountered: