SQL |
SELECT b.typ,b.amount,a.term_sale_id, a.term_sale_id, b.from_price
FROM tb_term_sale_entries b
LEFT JOIN tb_term_sales a WITH (NOLOCK) ON (a.term_sale_id=b.term_sale_id)
LEFT JOIN tb_styles c WITH (NOLOCK) ON (c.style_id=b.style_id)
WHERE b.start_date<= '2019-12-08 11:59:00'
AND b.end_date >= '2019-12-08 11:59:00'
and (b.store_id=89 or ISNULL(b.store_id,'') = '')
and b.style_id=138464 and a.approved='Y'
and isNull(b.attr1_entry_id,132078)=132078 and isNull(b.attr2_entry_id,70266)=70266
ORDER BY a.term_sale_id desc |