| SQL |
select customer_number, coalesce( customer_name, '' ) customer_name,
customer_address, coalesce( customer_address2, '') customer_address2, customer_city, customer_state, customer_zipcode, customer_territory_id,
sum( coalesce( case_qty, 0.0 )) case_qty, sum( coalesce( lb_qty, 0.0 ) ) lb_qty, sum( coalesce( extended_price, 0.0 )) extended_price
from tbl_IMPORT_InvoiceHistory with (nolock)
where ownerId = ?
and ownerType = ?
and eai_batchId = ?
group by customer_number, customer_name, customer_address,customer_address2, customer_city, customer_state, customer_zipcode,customer_territory_id
having sum( coalesce( case_qty, 0.0 )) <> 0 or sum( coalesce( lb_qty, 0.0 ) ) <> 0 or sum( coalesce( extended_price, 0.0 )) <> 0 |