select 
    1 value 
from 
    bi.daily_inventory
where 
    date(created_dt) = '{date}'
    and code2 = '{code}'
limit 1