<?xml version="1.0" encoding="utf-8" ?>
<?xml-stylesheet type="text/xsl" href="RSS_xslt_style.asp" version="1.0" ?>
<rss version="2.0" xmlns:WebWizForums="http://syndication.webwiz.co.uk/rss_namespace/">
 <channel>
  <title>DevForce Community Forum : Using subqueries with &#039;NOT IN&#039;</title>
  <link>http://www.ideablade.com/forum/</link>
  <description>This is an XML content feed of; DevForce Community Forum : DevForce Classic : Using subqueries with &#039;NOT IN&#039;</description>
  <pubDate>Tue, 14 Apr 2026 09:41:56 -700</pubDate>
  <lastBuildDate>Thu, 18 Dec 2008 14:09:48 -700</lastBuildDate>
  <docs>http://blogs.law.harvard.edu/tech/rss</docs>
  <generator>Web Wiz Forums 9.69</generator>
  <ttl>360</ttl>
  <WebWizForums:feedURL>www.ideablade.com/forum/RSS_post_feed.asp?TID=1025</WebWizForums:feedURL>
  <image>
   <title>DevForce Community Forum</title>
   <url>http://www.ideablade.com/forum/forum_images/IdeaBlade_logo_tm.png</url>
   <link>http://www.ideablade.com/forum/</link>
  </image>
  <item>
   <title>Using subqueries with &#039;NOT IN&#039; : See answer in thread http://ww...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=1025&amp;PID=3721#3721</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=11" rel="nofollow">kimj</a><br /><strong>Subject:</strong> 1025<br /><strong>Posted:</strong> 18-Dec-2008 at 2:09pm<br /><br />See answer in thread <a href="http://www.ideablade.com/forum/forum_posts.asp?TID=1026." target="_blank">http://www.ideablade.com/forum/forum_posts.asp?TID=1026.</A><DIV></DIV>]]>
   </description>
   <pubDate>Thu, 18 Dec 2008 14:09:48 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=1025&amp;PID=3721#3721</guid>
  </item> 
  <item>
   <title>Using subqueries with &#039;NOT IN&#039; :  (apologies for crossposting...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=1025&amp;PID=3713#3713</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=416" rel="nofollow">JonF</a><br /><strong>Subject:</strong> 1025<br /><strong>Posted:</strong> 17-Dec-2008 at 3:30pm<br /><br /><DIV><DIV>(apologies for crossposting this to a couple forums...&nbsp;wasn't sure which forum would be the best)</DIV><DIV>&nbsp;</DIV></DIV><DIV>Hi there, </DIV><DIV></DIV><DIV>&nbsp;</DIV><DIV>Was wondering if anyone could provide some insight into using subqueries with the 'NOT' operator.</DIV><DIV>&nbsp;</DIV><DIV>I have two parent tables, lets call them TABLE_A and TABLE_B.&nbsp; They are linked to each other through a simple&nbsp;linking table called TABLE_AB whose records are simply TABLE_A.primarykey and TABLE_B.primarykey.</DIV><DIV>&nbsp;</DIV><DIV>Now my issue is that I would like to get 2 lists of entities from TABLE_B.&nbsp; One list should be of all TABLE_B entities where the TABLE_B entity is linked to a given record in TABLE_A.&nbsp; This one is pretty straightforward.....</DIV><DIV>&nbsp;</DIV><DIV><FONT face="Courier New, Courier, mono">EntityQuery&nbsp;TABLE_B_query = new EntityQuery(typeof(TABLE_B));<BR>EntitySubquery subquery = TABLE_Bquery.AddSubquery(EntityRelations.TABLE_B_to_TABLE_AB.ToChild);<BR>subquery.AddClause(TABLE_AB.TABLE_A_primarykeyEntityColumn, EntityQueryOp.EQ, some_primarykey_from_TABLE_A);</FONT></DIV><DIV><FONT face="Courier New"></FONT>&nbsp;</DIV><DIV><FONT face="Arial, Helvetica, sans-serif">the above would return me a list of all entities from TABLE_B that are joined to a given record from TABLE_A.&nbsp; </FONT></DIV><DIV><FONT face=Arial></FONT>&nbsp;</DIV><DIV><FONT face=Arial>Now where I am having an issue is with with trying to get a list of entities from TABLE_B that are *NOT* joined to a given record from table A (essentially the inverse list).&nbsp; To write this in sql would be easy:&nbsp; </FONT></DIV><DIV><FONT face=Arial></FONT>&nbsp;</DIV><DIV><FONT face="Courier New, Courier, mono">select * from TABLE_B where TABLE_B.TABLE_B_primarykey NOT IN (select TABLE_B_primarykey FROM TABLE_AB where TABLE_A_primarykey = somevalue)</FONT></DIV><DIV><FONT face="Courier New"></FONT>&nbsp;</DIV><DIV><FONT face="Arial, Helvetica, sans-serif">But I'm having a tough time figuring out how to write this in an entityquery format.&nbsp; I could of course just write a passthrough query but unfortunately passthrough queries go straight to the database and I really need to be&nbsp;querying against&nbsp;the current persistencemanagers cache since it will have current updates (that have not been saved yet obviously).</FONT></DIV><DIV><FONT face=Arial></FONT>&nbsp;</DIV><DIV><FONT face=Arial>Thanks in advance for any help!</FONT></DIV><DIV><FONT face="Courier New"></FONT>&nbsp;</DIV><DIV><FONT size=2><P></FONT><FONT size=2></FONT><FONT size=2>&nbsp;</P></DIV></FONT>]]>
   </description>
   <pubDate>Wed, 17 Dec 2008 15:30:25 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=1025&amp;PID=3713#3713</guid>
  </item> 
 </channel>
</rss>