I've got a table: Year | Period | Account
During a new period, I'd like to get a list of new accounts and a list of accounts that also existed in the prior period.
Accounts that are also in the prior period:
bs.DataSource = from c in accountsToImport
join p in accountsToImport on c.Account equals p.Account
where c.Year == year && c.Period == period
&& p.Year == priorYear && p.Period == priorPeriod
select c;
return bs;
However, I can't figure out how to get the equivalent of " not equals p.account " with LINQ->SQL. The SQL command that does work:
select * from tsr_accountsToimport as cper
inner join tsr_accountstoimport as pper
on cper.account <> pper.account
where
cper.year = 2015
and cper.period = 4
and pper.period = 3
Any help to get the LINQ syntax would be greatly appreciated. Thanks!
You can try SelectMany instead of join.
from c in accounts
from p in accounts
where c.Account != p.Account
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.