Fixed filter location and query nulls
This commit is contained in:
@@ -31,5 +31,8 @@ LEFT JOIN (
|
||||
GROUP BY isite.itemsite_item_id
|
||||
) last_txn ON last_txn.itemsite_item_id = i.item_id
|
||||
WHERE (CURRENT_DATE - COALESCE(last_txn.last_transaction_date, i.item_created, cc.comment_date)::date)
|
||||
>= COALESCE(NULLIF('{{UnusedDays.text}}','')::int, 365)
|
||||
>= CASE
|
||||
WHEN '{{UnusedDays.text}}' ~ '^\d+$' THEN '{{UnusedDays.text}}'::int
|
||||
ELSE 365
|
||||
END
|
||||
ORDER BY "Days Unused" DESC
|
||||
|
||||
Reference in New Issue
Block a user