0

I have a SQL query and I need to convert it to a linq query - but I can't convert it properly.

Here is the SQL query:

SELECT 
    dbo.AlarmKodlari.AlarmKodu, dbo.AlarmKodlari.Tanimi
FROM   
    dbo.AlarmKodlari 
RIGHT OUTER JOIN               
    dbo.Hestipdetay ON dbo.AlarmKodlari.AlarmKodu = dbo.Hestipdetay.RaporTanimi 
RIGHT OUTER JOIN
    dbo.Partitions 
INNER JOIN                                                                      
    dbo.Musteriler ON dbo.Partitions.MustKod = dbo.Musteriler.MustKod 
INNER JOIN                      
    dbo.HesTipleri ON dbo.Musteriler.MustTipi = dbo.HesTipleri.TipKodu 
    ON dbo.Hestipdetay.TipKodu = dbo.HesTipleri.TipKodu
WHERE 
    (dbo.hestipdetay.raportipi = 4) 
    AND (dbo.Partitions.AboneNo = 399)
marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
  • I'd start with rearranging the JOIN/ON clauses, to make things clearer. – jarlh Oct 01 '21 at 10:11
  • I actually stuck with last inner join which there are two on here. And also dont know how to convert all query – mehmet dokuyucu Oct 01 '21 at 10:44
  • what have you got so far? Are you saying you've joined all but the last table? – Cato Oct 01 '21 at 11:05
  • yes, I can't join that part. In the last inner join ON dbo.Hestipdetay.TipKodu = dbo.HesTipleri.TipKodu. There are two on operation, linq dont allow to use two on in the same join – mehmet dokuyucu Oct 01 '21 at 11:35
  • Actually LINQ does allow that. Perhaps my [SQL to LINQ Recipe](https://stackoverflow.com/questions/49245160/sql-to-linq-with-multiple-join-count-and-left-join/49245786#49245786) might help you. – NetMage Oct 01 '21 at 18:26

0 Answers0