Hassle-free live chat software re-imagined for business growth. 2 users, always free.
Select Z.zip,Sum(sl_order.sales_qty) as sales_qty From sl_transaction inner join sl_order on sl_transaction.id = sl_order.transaction_id inner join (select dl2.id,stk_transfer.received_date,stk_transfer.stk_item_id, address.zip from stk_transfer inner join data_location dl2 on stk_transfer.del_loc_id = dl2.id inner join address on dl2.address_id = address.id Where stk_transfer.received_date between DATE_FORMAT('2016-05-01','%Y-%m-%d %h:%i:%s') and DATE_FORMAT('2016-08-26','%Y-%m-%d %h:%i:%s') and desp_loc_id = 101 and del_loc_id <> 8) as Z on Z.id = sl_transaction.location_id and Z.received_date < sl_transaction.updated_at and Z.stk_item_id = sl_order.stk_item_id Where sl_transaction.updated_at > DATE_FORMAT('2016-05-01','%Y-%m-%d %h:%i:%s') group by Z.zip
Join the community of 500,000 technology professionals and ask your questions.
Connect with top rated Experts
21 Experts available now in Live!