Skip to content

Commit

Permalink
fix: simplify speculator year query
Browse files Browse the repository at this point in the history
  • Loading branch information
pjsier committed Nov 4, 2024
1 parent cb7f5a7 commit fb5ac9e
Showing 1 changed file with 3 additions and 11 deletions.
14 changes: 3 additions & 11 deletions server/utils/queries.js
Original file line number Diff line number Diff line change
Expand Up @@ -329,17 +329,9 @@ async function queryPGDB({

case SPECULATOR_BY_YEAR:
/*Search property count by own_id by year*/
query = SQL`SELECT DISTINCT COUNT(ot.own_id),
ot.own_id, y.year
FROM owner_taxpayer AS ot
INNER JOIN taxpayer AS tp
ON ot.owntax_id = tp.owntax_id
INNER JOIN taxpayer_property AS tpp
ON tp.tp_id = tpp.tp_id
INNER JOIN year AS y
ON tpp.taxparprop_id = y.taxparprop_id
WHERE ot.own_id = ${ownid.toUpperCase()}
GROUP BY ot.own_id, y.year`
query = SQL`SELECT year, own_id, count
FROM owner_count
WHERE own_id = ${ownid.toUpperCase()}`

break

Expand Down

0 comments on commit fb5ac9e

Please sign in to comment.