SELECT
dbo.Receipt.transactionNumber,
dbo.Receipt.receiptDate,
dbo.Tafsil.description,
dbo.Branch.name,
SUM(dbo.SaleDetail.quantity) AS SalesQtyinclDis,
dbo.DeliveryOrderDetail.quantity AS SalesQty,
dbo.DeliveryOrderDetail.quantityDiscount AS Dis1,
dbo.DeliveryOrderDetail.supplierQuantityDiscount AS Dis2
FROM
dbo.SaleDetail
INNER JOIN
dbo.Sale
ON
(
dbo.SaleDetail.saleId = dbo.Sale.id)
INNER JOIN
dbo.Receipt
ON
(
dbo.Sale.invoiceReceiptId = dbo.Receipt.id)
INNER JOIN
dbo.Batch Batch_alias1
ON
(
dbo.SaleDetail.batchId = Batch_alias1.id)
INNER JOIN
dbo.Tafsil
ON
(
Batch_alias1.productId = dbo.Tafsil.id)
INNER JOIN
dbo.Branch
ON
(
dbo.Receipt.branchId = dbo.Branch.id)
INNER JOIN
dbo.DeliveryOrderDetail
ON
(
dbo.SaleDetail.orderDetailId = dbo.DeliveryOrderDetail.id)
INNER JOIN
dbo.Mohin
ON
(
dbo.Tafsil.mohinId = dbo.Mohin.id)
INNER JOIN
dbo.Kol
ON
(
dbo.Mohin.kolId = dbo.Kol.id)
WHERE
dbo.Receipt.receiptDate >= '2015-06-22'
AND dbo.Receipt.receiptDate < '2015-07-23'
GROUP BY
dbo.Receipt.transactionNumber,
dbo.Receipt.receiptDate,
dbo.Tafsil.description,
dbo.Branch.name,
dbo.DeliveryOrderDetail.quantity,
dbo.DeliveryOrderDetail.quantityDiscount,
dbo.DeliveryOrderDetail.supplierQuantityDiscount ;
Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.
When asked, what has been your best career decision?
Deciding to stick with EE.
Being involved with EE helped me to grow personally and professionally.
Connect with Certified Experts to gain insight and support on specific technology challenges including:
We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE