0

Hi everyone,
I am new in LINQ. Please let me help to convert the following SQL Query into LINQ query. The Query is :

SELECT	PRS.Product_Code, PRS.Purchase_Code, 
		PRS.Purchase_Details_Code, PRS.Lot_No,
		PRS.Lot_Amount, PRS.Sold_Amount,
		SS.Supplier_Code, SS.Name,
		ISNULL(SSS.Sales_Lot, 0) AS Sales_Lot
FROM Supplier_String AS SS
INNER JOIN
	(
		SELECT PD.Product_Code, PP.Purchase_Code, PP.Supplier_Code, 
		PPD.Purchase_Details_Code, PPD.Lot_No, PPD.Lot_Amount, PPD.Sold_Amount
		FROM Purchase_Product AS PP INNER JOIN Purchase_Product_Details AS PPD
		ON PP.Purchase_Code = PPD.Purchase_Code INNER JOIN Product_Details AS PD
		ON PD.Product_Code = PPD.Product_Code
	)
	AS PRS ON SS.Supplier_Code = PRS.Supplier_Code
LEFT OUTER JOIN 
	(
		SELECT SPD.Purchase_Details_Code, SUM(SPD.Sales_Lot) AS Sales_Lot
		FROM Sales_Product AS SP INNER JOIN Sales_Product_Details AS SPD
		ON SP.Sales_Code = SPD.Sales_Code
		GROUP BY SP.Sales_Code,SPD.Purchase_Details_Code
	)
	AS SSS ON SSS.Purchase_Details_Code = PRS.Purchase_Details_Code

Thanks in advance.

Nasir Uddin

3
Contributors
3
Replies
4
Views
5 Years
Discussion Span
Last Post by thines01
0

[If you have an option]
I would not suggest converting this to Linq-to-SQL if you are new to Linq.

If this is for class, I want to be in that class because it's cool!

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.