Click here to Skip to main content
14,243,072 members
Rate this:
Please Sign up or sign in to vote.
from inquiry sql I need to receive lambda linq yet absolutely I understood language, in a lambda expressions. There are many questions. But I try to understand everything rather. Very big SQL inquiry, in which some JOIN and still NOT EXIST met. I can't understand in any way as to compare everything though I made part, but can eat ways shorter than mine.

SELECT DISTINCT
    pblpat.nplpartref ,
    ppartt.npartgenu ,
    ppartt.xpartext ,
    pblpat.xordergun ,
    pblpat.hpartplblk ,
    ppartt.creplblpart
FROM    pblpat
    JOIN ppartt ON ( ppartt.clangjap = '2'
                     AND ppartt.npartgenu = pblpat.npartgenu
                   )
    LEFT OUTER JOIN pbprmt ON ( pbprmt.hpartplblk = pblpat.hpartplblk
                                AND pbprmt.clangjap = '2'
                              )
WHERE   pblpat.npl = '18SD401'
    AND pblpat.nplblk = 'BOP0100'
    AND ( ( EXISTS ( SELECT pb.hmodtyp
                     FROM   pbpmtt AS pb
                     WHERE  pb.hpartplblk = pblpat.hpartplblk
                            AND pb.hmodtyp = '23436' ) )
          OR ( ( NOT EXISTS ( SELECT    pb.hmodtyp
                              FROM      pbpmtt AS pb
                              WHERE     pb.hpartplblk = pblpat.hpartplblk )
               )
               AND ( EXISTS ( SELECT    pb.hmodtyp
                              FROM      pblmtt AS pb
                              WHERE     pb.npl = pblpat.npl
                                        AND pb.nplblk = pblpat.nplblk
                                        AND pb.hmodtyp = '23436' ) )
             )
        )
Posted
Comments
bowlturner 3-Jan-14 9:43am
   
I think you need to clarify what it is you would like us to answer. The SQL isn't that hard to understand, but I don't know what you want.
thatraja 3-Jan-14 9:45am
   
What? you want to convert this SQL query to LINQ?
astranexus 3-Jan-14 10:28am
   
I need to write LINQ lambda expression
Rate this:
Please Sign up or sign in to vote.

Solution 1

You may want to try Linqer[^], but be warned that any automated SQL to Linq conversion is likely to be suboptimal at best.

/ravi
   
Comments
astranexus 3-Jan-14 11:38am
   
Very Very Nice....!!!
Karthik_Mahalingam 3-Jan-14 12:09pm
   
good
Rate this:
Please Sign up or sign in to vote.

Solution 2

Use tools like LINQPad[^]
   
Comments
Karthik_Mahalingam 3-Jan-14 12:10pm
   
useful tool
Valery Possoz 3-Jan-14 17:13pm
   
I love Linqpad! such a great tool! and plenty of example of the c# in a nutshell book available. It's a great tool to use and a great tool to learn.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100