Files
psp_api/prisma/views/pos/StockMovements_View.sql
T

17 lines
501 B
SQL
Raw Normal View History

SELECT
`sm`.`id` AS `id`,
`sm`.`productId` AS `productId`,
`sm`.`type` AS `type`,
`sm`.`quantity` AS `quantity`,
`sm`.`fee` AS `fee`,
`sm`.`totalCost` AS `totalCost`,
`sm`.`referenceId` AS `referenceId`,
`sm`.`referenceType` AS `referenceType`,
`sm`.`createdAt` AS `createdAt`,
`sb`.`quantity` AS `current_stock`,
`sb`.`avgCost` AS `current_avg_cost`
FROM
(
`pos`.`Stock_Movements` `sm`
LEFT JOIN `pos`.`stock_balance` `sb` ON((`sb`.`ProductId` = `sm`.`productId`))
)