Is there someway to shortcut it? window function? Group by? Or is distinct the right approach?
select
distinct itemid item_id
from
unitactuals.unitserials
where
mfgdate > $begin_date_range
and mfgdate < $end_date_range
and siteid = $site_id
and serial like ($serial_prefix || '%')