<?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 Query not running with sub query in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/SQL-Query-not-running-with-sub-query/m-p/1670816#M727518</link>
    <description>&lt;P&gt;Qlikview does not execute the sql itself. It passes the entire statement to the oledb driver and that sends it to the database. If you don't get a result then first check that your query works at all. Try another sql client that let's you execute it directly on the database.&lt;/P&gt;</description>
    <pubDate>Thu, 30 Jan 2020 10:37:05 GMT</pubDate>
    <dc:creator>Gysbert_Wassenaar</dc:creator>
    <dc:date>2020-01-30T10:37:05Z</dc:date>
    <item>
      <title>SQL Query not running with sub query</title>
      <link>https://community.qlik.com/t5/QlikView/SQL-Query-not-running-with-sub-query/m-p/1670803#M727517</link>
      <description>&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am fetching some data from server (view is created on server) in my .qvw file. When i simply pull data using select statement it gives me the data.&lt;/P&gt;&lt;P&gt;But i modified the query inorder to pull data faster but now the query is not getting executed. Table with column gets created but no data is fetched. Can somebody help me here..?&lt;/P&gt;&lt;P&gt;Below is the query i am using:&lt;/P&gt;&lt;P&gt;OLEDB CONNECT32 TO [Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=ACVSBIRS;Data Source=Ewrdb1464;Use Procedure for Prepare=1;Auto Translate=True;Packet Size=4096;Workstation ID=R01-E7C6D9DE81;Use Encryption for Data=False;Tag with column collation when possible=False];&lt;BR /&gt;Ccure_SQL:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;SQL Select C.*, case when C.Att&amp;lt;=5 then '0-5 Days'&lt;BR /&gt;when C.Att&amp;gt;=6 and C.Att&amp;lt;=10 then '6-10 Days'&lt;BR /&gt;when C.Att&amp;gt;=11 and C.Att&amp;lt;=15 then '11-15 Days'&lt;BR /&gt;else '&amp;gt;15 Days'&lt;BR /&gt;end as Bracket&lt;/P&gt;&lt;P&gt;from&lt;/P&gt;&lt;P&gt;(select A.*,B.Att&lt;BR /&gt;from&lt;/P&gt;&lt;P&gt;(&lt;BR /&gt;SELECT cast(SiteLocalTime as date) as date1&lt;BR /&gt;,PrimaryObjectName&lt;BR /&gt;,[SecondaryPartitionName]&lt;BR /&gt;,[CardNo]&lt;BR /&gt;,[FacilityNo]&lt;BR /&gt;,[Personnel_Type]&lt;BR /&gt;,[Home_Location_]&lt;BR /&gt;,[LastName]&lt;BR /&gt;,[FirstName],&lt;BR /&gt;count(distinct [CardNo]) as D_Att,&lt;BR /&gt;month(cast(SiteLocalTime as date)) as Month_Field&lt;BR /&gt;FROM [ACVSBIRS].[dbo].[vQJournal]&lt;BR /&gt;where PrimaryObjectName = 'Vij, Sagar,' --and month(cast(SiteLocalTime as date)) = 11&lt;BR /&gt;group by&lt;BR /&gt;cast(SiteLocalTime as date)&lt;BR /&gt;,PrimaryObjectName&lt;BR /&gt;,[SecondaryPartitionName]&lt;BR /&gt;,[CardNo]&lt;BR /&gt;,[FacilityNo]&lt;BR /&gt;,[Personnel_Type]&lt;BR /&gt;,[Home_Location_]&lt;BR /&gt;,[LastName]&lt;BR /&gt;,[FirstName],&lt;BR /&gt;month(cast(SiteLocalTime as date))&lt;BR /&gt;)as A&lt;/P&gt;&lt;P&gt;left join&lt;/P&gt;&lt;P&gt;(select count(D_Att) as Att , [CardNo],Month_Field,PrimaryObjectName&lt;BR /&gt;from&lt;BR /&gt;(&lt;BR /&gt;SELECT cast(SiteLocalTime as date) as date1&lt;BR /&gt;,PrimaryObjectName&lt;BR /&gt;,[CardNo]&lt;BR /&gt;, count(distinct [CardNo]) as D_Att,&lt;BR /&gt;month(cast(SiteLocalTime as date)) as Month_Field&lt;BR /&gt;FROM [ACVSBIRS].[dbo].[vQJournal]&lt;BR /&gt;--where PrimaryObjectName = 'Vij, Sagar,'-- and month(cast(SiteLocalTime as date)) = 11&lt;BR /&gt;group by&lt;BR /&gt;cast(SiteLocalTime as date)&lt;BR /&gt;,[CardNo],&lt;BR /&gt;month(cast(SiteLocalTime as date)),&lt;BR /&gt;PrimaryObjectName&lt;BR /&gt;)x&lt;BR /&gt;group by&lt;BR /&gt;[CardNo],&lt;BR /&gt;Month_Field,&lt;BR /&gt;PrimaryObjectName&lt;BR /&gt;) as B&lt;/P&gt;&lt;P&gt;on A.[CardNo] = B.[CardNo] and A.Month_Field = B.Month_Field and A.PrimaryObjectName = B.PrimaryObjectName&lt;BR /&gt;) as C;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Exit Script&lt;/P&gt;</description>
      <pubDate>Sat, 16 Nov 2024 01:23:18 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/SQL-Query-not-running-with-sub-query/m-p/1670803#M727517</guid>
      <dc:creator>sagar_vij99</dc:creator>
      <dc:date>2024-11-16T01:23:18Z</dc:date>
    </item>
    <item>
      <title>Re: SQL Query not running with sub query</title>
      <link>https://community.qlik.com/t5/QlikView/SQL-Query-not-running-with-sub-query/m-p/1670816#M727518</link>
      <description>&lt;P&gt;Qlikview does not execute the sql itself. It passes the entire statement to the oledb driver and that sends it to the database. If you don't get a result then first check that your query works at all. Try another sql client that let's you execute it directly on the database.&lt;/P&gt;</description>
      <pubDate>Thu, 30 Jan 2020 10:37:05 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/SQL-Query-not-running-with-sub-query/m-p/1670816#M727518</guid>
      <dc:creator>Gysbert_Wassenaar</dc:creator>
      <dc:date>2020-01-30T10:37:05Z</dc:date>
    </item>
    <item>
      <title>Re: SQL Query not running with sub query</title>
      <link>https://community.qlik.com/t5/QlikView/SQL-Query-not-running-with-sub-query/m-p/1671245#M727519</link>
      <description>&lt;P&gt;Hi Gysbert.&lt;/P&gt;&lt;P&gt;Thanks for the reply. Actually i am fetching data from a view but not directly from table as i don't have rights to access table directly.&lt;/P&gt;&lt;P&gt;The thing is when i run this query in sql server, it is giving me desired results but it is not giving results when executed through qlikview. Is there any way i can use this through qlikview or shall i ask the database owner to create another view using my query.&lt;/P&gt;</description>
      <pubDate>Fri, 31 Jan 2020 10:58:20 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/SQL-Query-not-running-with-sub-query/m-p/1671245#M727519</guid>
      <dc:creator>sagar_vij99</dc:creator>
      <dc:date>2020-01-31T10:58:20Z</dc:date>
    </item>
    <item>
      <title>Re: SQL Query not running with sub query</title>
      <link>https://community.qlik.com/t5/QlikView/SQL-Query-not-running-with-sub-query/m-p/1678739#M727520</link>
      <description>&lt;P&gt;Sagar, I believe Gysbert was on the right track on this one, let me try to explain things another way here!&amp;nbsp; The underlying issue is most likely the 'Connector' you are using to communicate with the View in the Database is likely not able to translate those additional SQL statements, that is the first place I would look on this one, you will likely need to hit the Connector Vendor's support site to try to find limitations etc.&amp;nbsp; The other thing you could do is simply try to run that same query via say Microsoft Excel etc., as I would expect it is going to generate the same error, which if it does, you then have confirmation it is not on the QlikView/Excel side, it is most likely the Connector not liking the extra pieces in the Connect string or the SQL calls, and we are not going to be the ones to be able to help much if that is the case.&amp;nbsp; One thing to check is the Connector version you are running is the most current version for the backend Database you are hitting, as sometimes that is the issue, there is a newer client that needs to be installed in order to handle those new calls etc.&amp;nbsp; Hopefully this puts you on the right track such that you can get it resolved.&lt;/P&gt;
&lt;P&gt;Regards,&lt;BR /&gt;Brett&lt;/P&gt;</description>
      <pubDate>Mon, 24 Feb 2020 20:13:46 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/SQL-Query-not-running-with-sub-query/m-p/1678739#M727520</guid>
      <dc:creator>Brett_Bleess</dc:creator>
      <dc:date>2020-02-24T20:13:46Z</dc:date>
    </item>
  </channel>
</rss>

