<?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: Select top 1 record based on conditions in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Select-top-1-record-based-on-conditions/m-p/919249#M362086</link>
    <description>&lt;P&gt;I never used it but based on documentation &lt;A href="https://docs.snowflake.com/en/sql-reference/constructs/qualify" target="_self"&gt;here&lt;/A&gt; I believe your are looking for the Snowflake QUALIFY clause.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Patrick_0-1709796643965.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/94451iD01CA6C5812CF201/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Patrick_0-1709796643965.png" alt="Patrick_0-1709796643965.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 07 Mar 2024 07:31:01 GMT</pubDate>
    <dc:creator>Patrick</dc:creator>
    <dc:date>2024-03-07T07:31:01Z</dc:date>
    <item>
      <title>Select top 1 record based on conditions</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Select-top-1-record-based-on-conditions/m-p/919242#M362083</link>
      <description>&lt;P&gt;I know this is not a direct SAS question but still if someone can help it would be nice.&amp;nbsp; I'm connecting to Snowflake with explicit passthrough.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="uiOutputText"&gt;Any idea how to write the query like below without&lt;/SPAN&gt;&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;&lt;SPAN class="uiOutputText"&gt;introducing any new fields,&lt;/SPAN&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;SPAN class="uiOutputText"&gt;using exclude keyword&lt;/SPAN&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;SPAN class="uiOutputText"&gt;using CTE&lt;/SPAN&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;SPAN class="uiOutputText"&gt;using all the fields in group by&lt;/SPAN&gt;&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;&lt;SPAN class="uiOutputText"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class="uiOutputText"&gt;This sql is not working due to 'unexcepted over'. I want to select the max of ntwk_cd group or partition by the field PBK&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;SELECT   top 1 * over(partition by PBK order by ntwk_cd desc)  FROM PRAC12
WHERE ID = '098'
and PBK=063;&lt;/PRE&gt;</description>
      <pubDate>Thu, 07 Mar 2024 05:59:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Select-top-1-record-based-on-conditions/m-p/919242#M362083</guid>
      <dc:creator>Babloo</dc:creator>
      <dc:date>2024-03-07T05:59:09Z</dc:date>
    </item>
    <item>
      <title>Re: Select top 1 record based on conditions</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Select-top-1-record-based-on-conditions/m-p/919249#M362086</link>
      <description>&lt;P&gt;I never used it but based on documentation &lt;A href="https://docs.snowflake.com/en/sql-reference/constructs/qualify" target="_self"&gt;here&lt;/A&gt; I believe your are looking for the Snowflake QUALIFY clause.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Patrick_0-1709796643965.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/94451iD01CA6C5812CF201/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Patrick_0-1709796643965.png" alt="Patrick_0-1709796643965.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 07 Mar 2024 07:31:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Select-top-1-record-based-on-conditions/m-p/919249#M362086</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2024-03-07T07:31:01Z</dc:date>
    </item>
  </channel>
</rss>

