Base solution for your next web application
Open Closed

Best way to create a "NOT IN" Subquery #1492


User avatar
0
relix3000 created

Hi, I am learning several things related to ABP. Fantastic framework! I am having a big issue creating a NOT IN Subquery. Basically in SQL I'd write...

SELECT * FROM TABLE1 WHERE Table1.ID NOT IN (Select ID from TABLE2)

How would I go writing something like that in ABP?


2 Answer(s)
  • User Avatar
    0
    relix3000 created

    Wow, no one else has attempted this?

  • User Avatar
    0
    omital created

    Hi, your question in not directly related to ABP. In entityframework you can write like this:

    var res=from p in _tbl1Repo.GetAll()
                     where (_tbl2Repo.GetAll().Select(k=>k.Id).Contains(p.tbl2Id)==false
                    select p;