Guest User

Untitled

a guest
Nov 24th, 2017
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
SQL 1.59 KB | None | 0 0
  1. SELECT
  2.     `sbparser_item`.`gen_ledger`,
  3.     SUM(`sbparser_inventoryitemcount`.`amount`) AS `total`
  4. FROM `sbparser_inventoryitemcount`
  5. INNER JOIN `sbparser_itemcount`
  6. ON (`sbparser_inventoryitemcount`.`item_count_id` = `sbparser_itemcount`.`id`)
  7. INNER JOIN `sbparser_inventorycount`
  8. ON (`sbparser_itemcount`.`inventory_count_id` = `sbparser_inventorycount`.`id`)
  9. INNER JOIN `sbparser_inventoryreportingretailtransaction`
  10. ON (`sbparser_inventorycount`.`inventory_reporting_retail_transaction_id` = `sbparser_inventoryreportingretailtransaction`.`id`)
  11. INNER JOIN `sbparser_transaction`
  12. ON (`sbparser_inventoryreportingretailtransaction`.`transaction_id` = `sbparser_transaction`.`id`)
  13. LEFT OUTER JOIN `sbparser_item`
  14. ON (`sbparser_itemcount`.`item_id` = `sbparser_item`.`id`)
  15. WHERE (
  16.     `sbparser_transaction`.`business_day_date` BETWEEN '2011-08-01' AND '2011-08-31'
  17.     AND `sbparser_inventoryitemcount`.`valuation_method` = 'Actual'  
  18.     AND `sbparser_transaction`.`store_id` IN ('c750041', 'c750038', 'C750055', 'c750031', 'c750004', 'c750033', 'c750101', 'c750100', 'c750030', 'c750019', 'c750009', 'c750037', 'c750012', 'c750039', 'c750022', 'c750003', 'c750021', 'c750040', 'C750045', 'c750026', 'c759999', 'c750036', 'c750034', 'c750020', 'C750053', 'c750001', 'c750023', 'c750015', 'C750042', 'c750010', 'c750011', 'c750035', 'c750006', 'C750043', 'c750027', 'c750002', 'C750048', 'C750047', 'C750051', 'C750054', 'C750049', 'C750046', 'C750050', 'c750008', 'c750044', 'c750018')
  19.     AND NOT (`sbparser_inventorycount`.`count_type` = 'Physical' )
  20. )
  21. GROUP BY `sbparser_item`.`gen_ledger` ORDER BY NULL;
Add Comment
Please, Sign In to add comment