{"ok": true, "database": "cftracker", "query_name": "org_officials", "rows": [], "truncated": false, "columns": ["senator", "district", "current", "ties", "details", "first_year", "last_year", "source", "votes_on_its_bills", "voted_its_way"], "query": {"sql": "with t as (\n  select f.person_id, oil.principal,\n         group_concat(distinct case i.kind when 'income' then 'income from it' when 'business' then 'officer, director, member or owner' when 'security' then 'owns its stock or bonds' when 'gift' then 'gift from it' else i.kind end) as ties,\n         group_concat(distinct nullif(trim(coalesce(i.role, '') || ' ' || coalesce(i.value, '') || ' ' || coalesce(i.description, '')), '')) as details,\n         min(f.filing_year) as first_year, max(f.filing_year) as last_year,\n         max(i.source = 'scan') as from_scan\n  from official_interest_links oil\n  join official_interests i on i.interest_id = oil.interest_id\n  join official_filings f on f.filing_key = i.filing_key\n  where f.person_id is not null and oil.principal = :name\n  group by f.person_id, oil.principal\n)\nselect l.name as senator, l.district, l.current, t.ties, t.details, t.first_year, t.last_year,\n       case when t.from_scan then 'read from a scan' else 'electronic filing' end as source,\n       (select sum(vr.option in ('yes', 'no')) from org_positions op\n          join bill_final_votes fv on fv.legislature = op.legislature and fv.bill = op.bill\n          join vote_records vr on vr.vote_id = fv.vote_id and vr.person_id = t.person_id\n          where op.principal = t.principal and op.clear_position is not null) as votes_on_its_bills,\n       (select sum(op.clear_position = 'support' and vr.option = 'yes' or op.clear_position = 'oppose' and vr.option = 'no')\n          from org_positions op\n          join bill_final_votes fv on fv.legislature = op.legislature and fv.bill = op.bill\n          join vote_records vr on vr.vote_id = fv.vote_id and vr.person_id = t.person_id\n          where op.principal = t.principal and op.clear_position is not null) as voted_its_way\nfrom t join legislators l on l.person_id = t.person_id\norder by l.name", "params": {"name": ""}}, "error": null, "private": false, "allow_execute_sql": false, "query_ms": 14.221788005670533, "source": "FEC, Nebraska Accountability and Disclosure Commission, Clerk of the Legislature, Open States", "source_url": "https://www.fec.gov/data/", "license": "Public records"}