Skip to content

Instantly share code, notes, and snippets.

@sqlparser
Created April 8, 2014 08:03
Show Gist options
  • Save sqlparser/10100781 to your computer and use it in GitHub Desktop.
Save sqlparser/10100781 to your computer and use it in GitHub Desktop.
align main keywords
DELETE FROM job_history jh
WHERE employee_id = (SELECT employee_id
FROM employee e
WHERE jh.employee_id = e.employee_id
AND start_date = (SELECT Min(start_date)
FROM job_history jh
WHERE jh.employee_id = e.employee_id)
AND 5 > (SELECT Count( * )
FROM job_history jh
WHERE jh.employee_id = e.employee_id
GROUP BY employee_id
HAVING Count( * ) >= 4));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment