<?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 SQL query format help in Active IQ Unified Manager Discussions</title>
    <link>https://community.netapp.com/t5/Active-IQ-Unified-Manager-Discussions/SQL-query-format-help/m-p/55638#M11546</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; I need to refine an SQL query and have not been able to find syntax that appears to work.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Use Case:&lt;/P&gt;&lt;P&gt;In a workflow an admin selects a controller name from a drop-down&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; mysite1nodeA&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; mysite1nodeB&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; mysite2nodeA&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; mysite2nodeB&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Farther down in the workflow the admin must select a dataset and I need to refine it as too many volumes get put in the first returned.&lt;/P&gt;&lt;P&gt;For any given frame I will have two possible datasets, i.e.:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; mysite1nodeA_7_35&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; mysite1nodeB_7_35&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; mysite2nodeA_7_35&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; mysite2nodeB_7_35&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; mysite1node_0_35&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; mysite2node_0_35&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So selecting mysite1nodeA should be able to return - mysite1nodeA_7_35 or mysite1node_0_35&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;using this I can get mysite1node as part of the query, but I cannot determine where(or if possible) to place the wild card to match the rest of the dataset name, so I get no result.&amp;nbsp; In lab testing, creating a dataset named mysite1node returns, so the query as it stands is valid, just not what I need.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; DISTINCT dataset.name&lt;/P&gt;&lt;P&gt;FROM&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; storage.dataset&lt;/P&gt;&lt;P&gt;WHERE&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; dataset.name like substr('${src_array}',1,LENGTH('${src_array}')-1)&amp;nbsp; &amp;lt;-- returns the controller name minus the A or B, but I have not been able to place the required "%" that will actually match the dataset.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; AND dataset.name NOT LIKE '%_drive'&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; AND dataset.name NOT LIKE 'SnapMirrorLag'&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; AND dataset.dfm_name LIKE '${pm_dfm}'&lt;/P&gt;&lt;P&gt;ORDER BY&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; dataset.name &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any ideas for something other than my very basic SQL query capabilities would be greatly appreciated,&lt;/P&gt;&lt;P&gt;-Scott&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 05 Jun 2025 05:31:07 GMT</pubDate>
    <dc:creator>cscott</dc:creator>
    <dc:date>2025-06-05T05:31:07Z</dc:date>
    <item>
      <title>SQL query format help</title>
      <link>https://community.netapp.com/t5/Active-IQ-Unified-Manager-Discussions/SQL-query-format-help/m-p/55638#M11546</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; I need to refine an SQL query and have not been able to find syntax that appears to work.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Use Case:&lt;/P&gt;&lt;P&gt;In a workflow an admin selects a controller name from a drop-down&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; mysite1nodeA&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; mysite1nodeB&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; mysite2nodeA&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; mysite2nodeB&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Farther down in the workflow the admin must select a dataset and I need to refine it as too many volumes get put in the first returned.&lt;/P&gt;&lt;P&gt;For any given frame I will have two possible datasets, i.e.:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; mysite1nodeA_7_35&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; mysite1nodeB_7_35&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; mysite2nodeA_7_35&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; mysite2nodeB_7_35&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; mysite1node_0_35&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; mysite2node_0_35&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So selecting mysite1nodeA should be able to return - mysite1nodeA_7_35 or mysite1node_0_35&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;using this I can get mysite1node as part of the query, but I cannot determine where(or if possible) to place the wild card to match the rest of the dataset name, so I get no result.&amp;nbsp; In lab testing, creating a dataset named mysite1node returns, so the query as it stands is valid, just not what I need.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; DISTINCT dataset.name&lt;/P&gt;&lt;P&gt;FROM&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; storage.dataset&lt;/P&gt;&lt;P&gt;WHERE&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; dataset.name like substr('${src_array}',1,LENGTH('${src_array}')-1)&amp;nbsp; &amp;lt;-- returns the controller name minus the A or B, but I have not been able to place the required "%" that will actually match the dataset.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; AND dataset.name NOT LIKE '%_drive'&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; AND dataset.name NOT LIKE 'SnapMirrorLag'&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; AND dataset.dfm_name LIKE '${pm_dfm}'&lt;/P&gt;&lt;P&gt;ORDER BY&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; dataset.name &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any ideas for something other than my very basic SQL query capabilities would be greatly appreciated,&lt;/P&gt;&lt;P&gt;-Scott&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 05 Jun 2025 05:31:07 GMT</pubDate>
      <guid>https://community.netapp.com/t5/Active-IQ-Unified-Manager-Discussions/SQL-query-format-help/m-p/55638#M11546</guid>
      <dc:creator>cscott</dc:creator>
      <dc:date>2025-06-05T05:31:07Z</dc:date>
    </item>
    <item>
      <title>Re: SQL query format help</title>
      <link>https://community.netapp.com/t5/Active-IQ-Unified-Manager-Discussions/SQL-query-format-help/m-p/55643#M11548</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Ok, this is not really what I want and probably not efficient, but it greatly reduces the number of datasets.&amp;nbsp; I would still welcome a better way to do it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;BR /&gt;&lt;/TD&gt;&lt;TD&gt;AND dataset.name LIKE concat(trim(trailing 'a' from '${src_array}'),'%')&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;BR /&gt;&lt;/TD&gt;&lt;TD&gt;OR dataset.name like concat(trim(trailing 'b' from '${src_array}'),'%')&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 06 Aug 2014 18:55:41 GMT</pubDate>
      <guid>https://community.netapp.com/t5/Active-IQ-Unified-Manager-Discussions/SQL-query-format-help/m-p/55643#M11548</guid>
      <dc:creator>cscott</dc:creator>
      <dc:date>2014-08-06T18:55:41Z</dc:date>
    </item>
    <item>
      <title>Re: SQL query format help</title>
      <link>https://community.netapp.com/t5/Active-IQ-Unified-Manager-Discussions/SQL-query-format-help/m-p/55648#M11550</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Does what I need, for those who are unaware "_" is a special character for the SQL query, I had to escape it with "\"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;AND dataset.name LIKE concat(trim(trailing 'a' from '${src_array}'),'\_%')&lt;/P&gt;&lt;P&gt;OR dataset.name LIKE concat(trim(trailing 'b' from '${src_array}'),'\_%')&lt;/P&gt;&lt;P&gt;OR dataset.name LIKE '${src_array}%'&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Still have to believe there is a better way though.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;- Scott&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 06 Aug 2014 19:30:08 GMT</pubDate>
      <guid>https://community.netapp.com/t5/Active-IQ-Unified-Manager-Discussions/SQL-query-format-help/m-p/55648#M11550</guid>
      <dc:creator>cscott</dc:creator>
      <dc:date>2014-08-06T19:30:08Z</dc:date>
    </item>
  </channel>
</rss>

