<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Question about troublesome SQL Join in SAS Data Management</title>
    <link>https://communities.sas.com/t5/SAS-Data-Management/Question-about-troublesome-SQL-Join/m-p/117395#M1388</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks, I've removed the DISTINCT and created an index. Hopefully it'll finish this time.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Btw, for some reason DI Studio autoformats this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;MASTER.CUST_NO NOT IN (SELECT CUST_NO FROM EXCLUDE)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Into this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;MASTER.CUST_NO NOT IN (SELECT &lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;EXCLUDE&lt;/SPAN&gt;.CUST_NO FROM EXCLUDE)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;It seems a bit odd that the table name EXCLUDE is repeated like that. Does it matter? If I remove the FROM, I get a syntax error.&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 07 Jan 2013 15:07:50 GMT</pubDate>
    <dc:creator>TurnTheBacon</dc:creator>
    <dc:date>2013-01-07T15:07:50Z</dc:date>
    <item>
      <title>Question about troublesome SQL Join</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Question-about-troublesome-SQL-Join/m-p/117393#M1386</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Imagine that you have two tables:&lt;/P&gt;&lt;P&gt;- One master table that contains all the data you need. It has a PK called CUST_NO.&lt;/P&gt;&lt;P&gt;- One control table that determines what data should never be included in queries. It only has one column, also called CUST_NO.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I want to use an SQL Join transformation in DI Studio that should extract all the rows from the master table, except for the ones with a CUST_NO that matches the CUST_NO from the control table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How do I perform this query most efficiently? I've tried the two following approaches, but I suspect something is wrong, because they never seem to finish.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;1. MASTER.CUST_NO NOT IN (SELECT DISTINCT CUST_NO FROM EXCLUDE)&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;2. MASTER.CUST_NO ^= EXCLUDE.CUST_NO&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for your time. &lt;img id="smileyhappy" class="emoticon emoticon-smileyhappy" src="https://communities.sas.com/i/smilies/16x16_smiley-happy.png" alt="Smiley Happy" title="Smiley Happy" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 07 Jan 2013 14:31:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Question-about-troublesome-SQL-Join/m-p/117393#M1386</guid>
      <dc:creator>TurnTheBacon</dc:creator>
      <dc:date>2013-01-07T14:31:14Z</dc:date>
    </item>
    <item>
      <title>Re: Question about troublesome SQL Join</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Question-about-troublesome-SQL-Join/m-p/117394#M1387</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;1. Should work fine. You don't need DISTINCT.&amp;nbsp; You should define an index on EXCLUDE.CUST_NO.&lt;/P&gt;&lt;P&gt;2. Cannot work. The condition is true for all values of EXCLUDE.CUST_NO or for all values of EXCLUDE.CUST_NO except one.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PG&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 07 Jan 2013 14:49:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Question-about-troublesome-SQL-Join/m-p/117394#M1387</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2013-01-07T14:49:26Z</dc:date>
    </item>
    <item>
      <title>Re: Question about troublesome SQL Join</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Question-about-troublesome-SQL-Join/m-p/117395#M1388</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks, I've removed the DISTINCT and created an index. Hopefully it'll finish this time.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Btw, for some reason DI Studio autoformats this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;MASTER.CUST_NO NOT IN (SELECT CUST_NO FROM EXCLUDE)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Into this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;MASTER.CUST_NO NOT IN (SELECT &lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;EXCLUDE&lt;/SPAN&gt;.CUST_NO FROM EXCLUDE)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;It seems a bit odd that the table name EXCLUDE is repeated like that. Does it matter? If I remove the FROM, I get a syntax error.&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 07 Jan 2013 15:07:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Question-about-troublesome-SQL-Join/m-p/117395#M1388</guid>
      <dc:creator>TurnTheBacon</dc:creator>
      <dc:date>2013-01-07T15:07:50Z</dc:date>
    </item>
    <item>
      <title>Re: Question about troublesome SQL Join</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Question-about-troublesome-SQL-Join/m-p/117396#M1389</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The reformated version may seem redundant but it is perfectly equivalent. - PG&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 07 Jan 2013 15:14:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Question-about-troublesome-SQL-Join/m-p/117396#M1389</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2013-01-07T15:14:11Z</dc:date>
    </item>
    <item>
      <title>Re: Question about troublesome SQL Join</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Question-about-troublesome-SQL-Join/m-p/117397#M1390</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You're into the soup of SQL query optimization. I'm not sure if your version will minimize the explosion, but if it doesn't this might work better:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;select m.* from master m left join exclude e on(m.cust_no = e.cust_no) where e.cust_no is null&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 07 Jan 2013 17:22:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Question-about-troublesome-SQL-Join/m-p/117397#M1390</guid>
      <dc:creator>TomKari</dc:creator>
      <dc:date>2013-01-07T17:22:20Z</dc:date>
    </item>
  </channel>
</rss>

