Skip to content

Instantly share code, notes, and snippets.

@eberloso
Created October 11, 2019 10:33
Show Gist options
  • Select an option

  • Save eberloso/83ef60b74b59897a5564885641bc3c74 to your computer and use it in GitHub Desktop.

Select an option

Save eberloso/83ef60b74b59897a5564885641bc3c74 to your computer and use it in GitHub Desktop.
Detectar casos ATR amb passos amb header que no estan al step_ids
select
sw.id,
count(header.id) as headers,
(select count(*) from giscedata_switching_step_info where sw_id = sw.id group by sw_id) as steps
from giscedata_switching_step_header header
JOIN giscedata_switching sw ON sw.id=header.sw_id
group by sw.id
having
count(header.id) != (select count(*) from giscedata_switching_step_info where sw_id = sw.id group by sw_id);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment