我该怎么做? 其中tsc.TransactionID in(来自交易中的t,其中........
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
});
答案 0 :(得分:2)
您可以使用包含:
where (from t in Transactions
where t.StockpileID == 7122
select t.TransactionID).Contains(tsc.TransactionID)
请注意,使用其他联接可能更有效,更合适:
join t in Transactions.Where(t => t.StockpileID == 7122)
on tsc.TransactionId equals t.TransactionID