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

Recommended Answers

All 3 Replies

[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!

Are you still looking for an answer to this?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.