Click here to Skip to main content
15,797,683 members
Please Sign up or sign in to vote.
3.50/5 (2 votes)
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.

    pblpat.nplpartref ,
    ppartt.npartgenu ,
    ppartt.xpartext ,
    pblpat.xordergun ,
    pblpat.hpartplblk ,
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' ) )
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

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

Share this answer
astranexus 3-Jan-14 11:38am    
Very Very Nice....!!!
Karthik_Mahalingam 3-Jan-14 12:09pm    
Use tools like LINQPad[^]
Share this answer
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, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900