tags:

views:

36

answers:

1

How can i do this ? where tsc.TransactionID in (from t in Transactions where ........

        Eg:
        var query = (from tsd in TransactionSampleDetails 
  join tsc in TransactionSamples on  tsd.TransactionSampleID equals tsc.TransactionSampleID
  join qp in QualityParameters on tsd.ParameterID equals qp.ParameterID
  where tsc.TransactionID in (from t in Transactions where t.StockpileID == 7122 select t.TransactionID)
  select new 
  { 
   TransactionID = tsc.TransactionID,
   ParameterName = qp.Parameter,
   ParameterValue = tsd.ActualValue
  });
+1  A: 

You can use Contains:

where (from t in Transactions 
       where t.StockpileID == 7122 
       select t.TransactionID).Contains(tsc.TransactionID)

Mind you, it might be more efficient and appropriate to use another join:

join t in Transactions.Where(t => t.StockpileID == 7122)
  on tsc.TransactionId equals t.TransactionID
Jon Skeet