2010-06-16 6 views
0

Comment puis-je convertir cette requête SQL à son instruction SQL LINQ 2 équivalente pour VB.NET?Comment réécrire cette instruction SQL à LINQ 2 SQL?

SELECT COUNT(*) AS 'Qty', 
IV200.itemnmbr, 
IV200.locncode, 
IV200.bin, 
CAST(IV112.Quantity as int) as 'Qty2' , 
'parentBIN' = isnull(MDS.parentBIN,iv112.bin) 
    From IV00200 IV200 (nolock) 
    inner join IV00112 IV112 (nolock) 
         on iv200.itemnmbr = iv112.itemnmbr 
         and IV200.bin = IV112.bin 
         and iv200.locncode = iv112.locncode 
    left outer join mds_container mds (nolock) 
         on isnull(mds.locncode,'nul') = isnull(iv112.locncode,'nul') 
         and isnull(mds.containerbin,'nul') = isnull(iv112.bin,'nul') 
         where IV200.bin = 'MU7I336A80' 
    group by IV200.itemnmbr, 
      IV200.locncode, 
      IV200.bin, 
      IV112.Quantity, 
      isnull(MDS.parentBIN,iv112.bin) 
    order by IV200.itemnmbr 
+0

Mes yeux! Cela nécessite un formatage sérieux –

Répondre

1

Jetez un oeil à un produit nommé Linqer (www.sqltolinq.com). Nous utilisons cela en interne pour convertir des requêtes SQL plus complexes en Linq. Ce n'est pas gratuit, mais ce n'est pas cher non plus, et vient avec un essai de 30 jours.

Questions connexes