<?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: SQL Main table with criteria + inner join from a secondary table in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/SQL-Main-table-with-criteria-inner-join-from-a-secondary-table/m-p/642634#M191749</link>
    <description>Thanks so much Chris! Thats a lot simpler than what i was doing!</description>
    <pubDate>Fri, 24 Apr 2020 15:11:22 GMT</pubDate>
    <dc:creator>Debora1</dc:creator>
    <dc:date>2020-04-24T15:11:22Z</dc:date>
    <item>
      <title>SQL Main table with criteria + inner join from a secondary table</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SQL-Main-table-with-criteria-inner-join-from-a-secondary-table/m-p/642433#M191644</link>
      <description>&lt;P&gt;Hello!&lt;/P&gt;&lt;P&gt;I am using SQL trying to view the nct_id column that matches 3&amp;nbsp; criteria and i have 2 tables that share the nct_id.&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;2 criterias are within the table studies&lt;/LI&gt;&lt;LI&gt;Last criteria is in table interventions.&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;I am not sure how to connect first two criterias to the inner join, do you have any clue?&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;select studies.nct_id 
	from studies where study_type='Interventional' and overall_status='Completed'
	inner join interventions 
		on studies.nct_id=interventions.nct_id where intervention_type='Drug';	&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;SPAN&gt;ERROR: syntax error at or near "inner" LINE 20: inner join interventions on studies.nct_id=interventions.n... ^&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Many thanks!&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 24 Apr 2020 01:08:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SQL-Main-table-with-criteria-inner-join-from-a-secondary-table/m-p/642433#M191644</guid>
      <dc:creator>Debora1</dc:creator>
      <dc:date>2020-04-24T01:08:01Z</dc:date>
    </item>
    <item>
      <title>Re: SQL Main table with criteria + inner join from a secondary table</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SQL-Main-table-with-criteria-inner-join-from-a-secondary-table/m-p/642438#M191645</link>
      <description>&lt;P&gt;You only need one "where" after your "from". You can specify what table to apply your filter by using its alias (or table name in your code)&lt;/P&gt;
&lt;P&gt;Try this&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;select studies.nct_id
from studies &lt;BR /&gt;inner join interventions 
on studies.nct_id=interventions.nct_id

where studies.study_type = 'Interventional' and studies.overall_status = 'Completed'
and intervention.intervention_type = 'Drug'&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 24 Apr 2020 01:51:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SQL-Main-table-with-criteria-inner-join-from-a-secondary-table/m-p/642438#M191645</guid>
      <dc:creator>sustagens</dc:creator>
      <dc:date>2020-04-24T01:51:13Z</dc:date>
    </item>
    <item>
      <title>Re: SQL Main table with criteria + inner join from a secondary table</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SQL-Main-table-with-criteria-inner-join-from-a-secondary-table/m-p/642451#M191654</link>
      <description>&lt;P&gt;Or, if you want use SAS data set options:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;select studies.nct_id 
  from studies(where=(study_type='Interventional' and overall_status='Completed'))
         inner join
       interventions (where=(intervention_type='Drug'))
	     on studies.nct_id = interventions.nct_id &lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 24 Apr 2020 04:22:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SQL-Main-table-with-criteria-inner-join-from-a-secondary-table/m-p/642451#M191654</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2020-04-24T04:22:26Z</dc:date>
    </item>
    <item>
      <title>Re: SQL Main table with criteria + inner join from a secondary table</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SQL-Main-table-with-criteria-inner-join-from-a-secondary-table/m-p/642503#M191683</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
create table want as
  select studies.nct_id 
  from studies st, interventions in
  where
    st.nct_id = in.nct_id
    and st.study_type = 'Interventional' and st.overall_status = 'Completed'
	and in.intervention_type = 'Drug'
;	
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 24 Apr 2020 09:57:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SQL-Main-table-with-criteria-inner-join-from-a-secondary-table/m-p/642503#M191683</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2020-04-24T09:57:10Z</dc:date>
    </item>
    <item>
      <title>Re: SQL Main table with criteria + inner join from a secondary table</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SQL-Main-table-with-criteria-inner-join-from-a-secondary-table/m-p/642632#M191747</link>
      <description>Thaaaanks so much! Thaaat now makes a lot of sense!</description>
      <pubDate>Fri, 24 Apr 2020 15:09:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SQL-Main-table-with-criteria-inner-join-from-a-secondary-table/m-p/642632#M191747</guid>
      <dc:creator>Debora1</dc:creator>
      <dc:date>2020-04-24T15:09:32Z</dc:date>
    </item>
    <item>
      <title>Re: SQL Main table with criteria + inner join from a secondary table</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SQL-Main-table-with-criteria-inner-join-from-a-secondary-table/m-p/642634#M191749</link>
      <description>Thanks so much Chris! Thats a lot simpler than what i was doing!</description>
      <pubDate>Fri, 24 Apr 2020 15:11:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SQL-Main-table-with-criteria-inner-join-from-a-secondary-table/m-p/642634#M191749</guid>
      <dc:creator>Debora1</dc:creator>
      <dc:date>2020-04-24T15:11:22Z</dc:date>
    </item>
    <item>
      <title>Re: SQL Main table with criteria + inner join from a secondary table</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SQL-Main-table-with-criteria-inner-join-from-a-secondary-table/m-p/642635#M191750</link>
      <description>Hello Kurt!&lt;BR /&gt;Thanks, that was also something I was looking to do</description>
      <pubDate>Fri, 24 Apr 2020 15:13:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SQL-Main-table-with-criteria-inner-join-from-a-secondary-table/m-p/642635#M191750</guid>
      <dc:creator>Debora1</dc:creator>
      <dc:date>2020-04-24T15:13:21Z</dc:date>
    </item>
  </channel>
</rss>

