locked
use subQury in where RRS feed

  • Question

  • hi

    i have a query below like :

    var q =
                  
                    (from lindailyamar in db.LinDailyAmars
                     join lindailyamaritems in db.LinDailyAmarItems
                           on new { lindailyamar.LineVoyageId, lindailyamar.LinDailyAmarFromD }
                       equals new { lindailyamaritems.LineVoyageId, lindailyamaritems.LinDailyAmarFromD }
                     join linevoyage in db.LineVoyages
                           on new { lindailyamaritems.LineVoyageId, LineVoyageFileFlag = "1", LineVoyageState = "0", LineVoyageShippingCode = "04", lindailyamaritems.GoodsTypeTarifTypeCode }
                       equals new { LineVoyageId = linevoyage.LineVoyageID, linevoyage.LineVoyageFileFlag, linevoyage.LineVoyageState, linevoyage.LineVoyageShippingCode, GoodsTypeTarifTypeCode = "2" }
                     group lindailyamar by new
                     {
                         linevoyage.LineVoyageID
                     } into g
                     where g.Max(p => p.LinDailyAmarFromD).CompareTo("910801") > 0 && g.Max(p => p.LinDailyAmarFromD).CompareTo("910820") < 0
                     select new Items
                     {
                         LineVoyageID = (System.Decimal)g.Key.LineVoyageID
                     });


    the result is type of decimal and return a list from decimal

    and another qury below like :

    from lindailyamaritems in db.LinDailyAmarItems
                             join linevoyage in db.LineVoyages on new { LineVoyageId = lindailyamaritems.LineVoyageId } equals new { LineVoyageId = linevoyage.LineVoyageID }
                             where

    how to i can use the first query in where second query

    please help me

    thanks

    Saturday, January 12, 2013 11:35 AM

All replies

  • Hi Vahidbakhtiary,

    Welcome to the MSDN forum.

    As you mentioned, the q is a list of decimal. Could you please how do you want to use q in where clause?

    Can you explain it in detail?

    Have a nice day.


    Alexander Sun [MSFT]
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Monday, January 14, 2013 3:02 AM