Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dupe bills between systems #377

Open
fgregg opened this issue Oct 18, 2023 · 0 comments
Open

dupe bills between systems #377

fgregg opened this issue Oct 18, 2023 · 0 comments
Labels

Comments

@fgregg
Copy link
Member

fgregg commented Oct 18, 2023

this query helps find dupe bills between the two lis systems

with dupes as (
  select
    A.id as a_id,
    B.id as b_id
  from
    bill as A
    inner join bill as B using (title)
    inner join billaction B_action on B.id = B_action.bill_id
    left join billaction A_action on A.id = A_action.bill_id
    and A_action.date = B_action.date
    and A_action.description = B_action.description
  where
    length(A.identifier) > 13
    and length(B.identifier) < 13
    and A.identifier like '%2023%'
    and B.identifier like '%2023%'
  group by
    A.id,
    B.id
  having
    count(*) filter (
      where
        A_action.id is null
    ) = 0
)
select
  *
from
  dupes
  inner join bill A on a_id = A.id
  inner join bill B on b_id = B.id;
@derekeder derekeder added the bug label Jan 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants