How can I convert the following SQL query into linq? This is what is tried
SELECT COUNT(DISTINCT SampleDateTime) AS Total
FROM dbo.PrecisionArchive
WHERE AgencySourceId = 7 AND EventType IN('R', 'ONS')
How can I convert the following SQL query into linq? This is what is tried
SELECT COUNT(DISTINCT SampleDateTime) AS Total
FROM dbo.PrecisionArchive
WHERE AgencySourceId = 7 AND EventType IN('R', 'ONS')
Something like this should work:
You could also try using
Contains
to represent theIN
clause, but I don't believe this is supported by Linq-to-SQL:You could use: