Is there a LINQ To SQL equivalent to the SQL between keyword?
Do I just need to And both comparisons?
SELECT first_name, last_name
FROM people
WHERE last_name between 'Smith' and 'Thompson'
I assume you mean "in Linq to Sql". Linq by itself just passes the expression to the LinqProvider which translates it into something appropriate for the data store being queried.
That being said, I'm pretty sure that the MSSQL provider used by Linq to Sql will translate last_name >= "Smith" and last_name <= "Thomson" into a BETWEEN expression.
UPDATE: Empirical evidence (via LINQPad) shows that it does not translate to BETWEEN
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With