locked
Query Syntax: Join and Filter RRS feed

  • Question

  • I am new to .net, lightswitch, and Linq and I am having troubl with the correct syntax.   I would like to replicate the results of the following query in a preprocessquery method on a query of the povendor table.

    SELECT POV.VENDOR, POV.FAX_NUMBER, POV.VENDOR_CONTCT, POV.EMAIL_ADDRESS, POV.PHONE_NUM
    
    FROM POVENDOR AS POV
    
    JOIN POAck.POAck.POACKSTATUS AS POA ON POA.VENDOR = POV.VENDOR
    
    WHERE POA.POACK = 0
    
    GROUP BY POV.VENDOR, POV.FAX_NUMBER, POV.VENDOR_CONTCT, POV.EMAIL_ADDRESS, POV.PHONE_NUM
    
    
    

    There is a relationship defined between the POVENDOR and POAck tables.   This is in SQL server.  

    I have tried this: 

    query = query.Where(a => a.POACKSTATUS.Where(b => b.POACK.ToString() ==

    "0"

    ).Any()).Distinct();

    Thanks,

    Sunday, September 18, 2011 5:42 PM