The SQL query is probably something like:
SELECT LastName FROM Providers
WHERE LastName LIKE 'PrefixText%'
ORDER BY LastName
LIMIT count; -- This may be TOP in MS SQL or ROWNUM in Oracle
Which means:
Give me all rows from the table Providers
where the LastName
column starts with PrefixText (whatever that variable contains). I want them sorted alphabetically by the LastName
column, and I only want the first count rows (i.e., if count
was equal to 50, you’d get up to 50 rows)
Sure, you can do a JOIN
. You can refer to another table within your Where
expression:
db.Providers.Where(n => n.ProviderGroup.ADgroup == 'Active Dir Group')
And the framework will automatically join in ADgroup
for you, provided your model provides the necessary relationships between your tables.
8
solved Please Translate this from C# to SQL in plain english [closed]