<?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 Select from select query in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Select-from-select-query/m-p/209420#M51900</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Is this possible to run a query from already written query like&lt;/P&gt;&lt;P&gt;select distinct salary from (select user_id, sum(salary) from emp where month =3 group by user_id) ;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;this is an example so consider we are having 10 different sum of salary ...but i want to figure that out from select * from select query ....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for reverting back ..&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 05 May 2015 06:31:30 GMT</pubDate>
    <dc:creator>LearnByMistk</dc:creator>
    <dc:date>2015-05-05T06:31:30Z</dc:date>
    <item>
      <title>Select from select query</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Select-from-select-query/m-p/209420#M51900</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Is this possible to run a query from already written query like&lt;/P&gt;&lt;P&gt;select distinct salary from (select user_id, sum(salary) from emp where month =3 group by user_id) ;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;this is an example so consider we are having 10 different sum of salary ...but i want to figure that out from select * from select query ....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for reverting back ..&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 05 May 2015 06:31:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Select-from-select-query/m-p/209420#M51900</guid>
      <dc:creator>LearnByMistk</dc:creator>
      <dc:date>2015-05-05T06:31:30Z</dc:date>
    </item>
    <item>
      <title>Re: Select from select query</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Select-from-select-query/m-p/209421#M51901</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yes, you can do nested queries.&lt;/P&gt;&lt;P&gt;If you want to continue work on a query that is already definied, save it into a table by using create table ... as select ...&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 05 May 2015 08:41:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Select-from-select-query/m-p/209421#M51901</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2015-05-05T08:41:07Z</dc:date>
    </item>
    <item>
      <title>Re: Select from select query</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Select-from-select-query/m-p/209422#M51902</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yes, you can do that no problem, its called a subquery when another one is nestled in brackets.&amp;nbsp; I would however wonder why you are doing it like that, there are times to use subqueries, however from what you have said and posted, I don't think this is one of them.&amp;nbsp; Perhaps post some test data and required output.&amp;nbsp; Just from what you have posted, assuming it is differing months then:&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px; background-color: #ffffff;"&gt;select user_id, sum(salary) from emp group by month,user_id&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px; background-color: #ffffff;"&gt;rather than several queries.&amp;nbsp; Also note that distinct salary may return more than one row from your query, so how will handle that?&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 05 May 2015 08:42:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Select-from-select-query/m-p/209422#M51902</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2015-05-05T08:42:30Z</dc:date>
    </item>
    <item>
      <title>Re: Select from select query</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Select-from-select-query/m-p/209423#M51903</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yes RW9@ &amp;amp; KurtBremser... i agree there are multiple ways but couldn't bring them that time so used that..&lt;/P&gt;&lt;P&gt;actually i used earlier select a,b from (select id ,cat from T 1 where some condition) aliasname....as i forgot to put this alias name so it makes me to put question&amp;nbsp; here on discussion portal ...but thanks for the effrort you guys put ..i appreciate it .thanks..&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 06 May 2015 04:35:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Select-from-select-query/m-p/209423#M51903</guid>
      <dc:creator>LearnByMistk</dc:creator>
      <dc:date>2015-05-06T04:35:18Z</dc:date>
    </item>
  </channel>
</rss>

