<?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: Trying to do this SQL in Qlik in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Trying-to-do-this-SQL-in-Qlik/m-p/83039#M784408</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You want to use the now() function of qlikview in SQL? Am I right?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if that, first declare a variable with LET (not SET)&amp;nbsp; to be the Now function i.e.:&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;Let &lt;/SPAN&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;NowTime&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt;"&gt;= Date(Today(),'DD-MM-YYYY')-1;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then load it in SQL:&lt;/P&gt;&lt;P&gt;Load *;&lt;/P&gt;&lt;P&gt;SQL Declare&lt;/P&gt;&lt;P&gt;....&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;set @fecha =&lt;/SPAN&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;$(vAñoInicio);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;... &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;YOUR SQL);&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 09 Mar 2018 17:58:36 GMT</pubDate>
    <dc:creator>cristian_av</dc:creator>
    <dc:date>2018-03-09T17:58:36Z</dc:date>
    <item>
      <title>Trying to do this SQL in Qlik</title>
      <link>https://community.qlik.com/t5/QlikView/Trying-to-do-this-SQL-in-Qlik/m-p/83038#M784407</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi all i am wanting to start making some reports that i do in Sql to my company but when i try to migrate the sql query to qlik i have some syntax errors...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is the query i want to launch...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SQL Declare @Sucursal int, @fecha date;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;set @Sucursal = 11;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;set @fecha = Getdate() - 1;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;select max(FechaRecepcion ) as Fecha, max(so.sucursalnombre) as Sucursalorigen, &lt;/P&gt;&lt;P&gt;e.TipoComprobante as TipoComp,sum(e.subtotal-e.descuento+e.iva+e.seguro) as ImporteTotal,&lt;/P&gt;&lt;P&gt;max(sd.sucursalnombre) as SucursalDestino, iif(e.OrigenPago = 'D','DES','ORG') as OrgPago&lt;/P&gt;&lt;P&gt;from dbo.Envios e&amp;nbsp; &lt;/P&gt;&lt;P&gt;inner join dbo.Sucursales so &lt;/P&gt;&lt;P&gt;on so.sucursalid = e.sucursalidorigen&amp;nbsp; &lt;/P&gt;&lt;P&gt;inner join dbo.Sucursales sd &lt;/P&gt;&lt;P&gt;on sd.sucursalid = e.sucursaliddestino&amp;nbsp; &lt;/P&gt;&lt;P&gt;left join dbo.Clientes co &lt;/P&gt;&lt;P&gt;on e.clienteidorigen = co.clienteid&amp;nbsp; &lt;/P&gt;&lt;P&gt;left join dbo.Clientes cd &lt;/P&gt;&lt;P&gt;on e.clienteiddestino = cd.clienteid&amp;nbsp; &lt;/P&gt;&lt;P&gt;left join dbo.Empleados ef &lt;/P&gt;&lt;P&gt;on e.empleadofacturacion = ef.empleadoid&amp;nbsp; &lt;/P&gt;&lt;P&gt;where Fecharecepcion = @fecha and Anulado = 0 and Tipocomprobante is not null&lt;/P&gt;&lt;P&gt;and SucursalIDEmision &amp;lt; 20 and SucursalIDDestino &amp;lt; 20 and Tipocomprobante IN ('FA', 'FB')&lt;/P&gt;&lt;P&gt;group by&amp;nbsp; so.sucursalnombre, e.TipoComprobante, OrigenPago, e.SucursalIDDestino; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When i run the script it say i need to declare the variable @fecha but either exchanging Getdate() for Now() or Date() it doesnt seems to work...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Wich is the correct syntax??&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks so much!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 25 Nov 2020 16:16:04 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Trying-to-do-this-SQL-in-Qlik/m-p/83038#M784407</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-11-25T16:16:04Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to do this SQL in Qlik</title>
      <link>https://community.qlik.com/t5/QlikView/Trying-to-do-this-SQL-in-Qlik/m-p/83039#M784408</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You want to use the now() function of qlikview in SQL? Am I right?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if that, first declare a variable with LET (not SET)&amp;nbsp; to be the Now function i.e.:&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;Let &lt;/SPAN&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;NowTime&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt;"&gt;= Date(Today(),'DD-MM-YYYY')-1;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then load it in SQL:&lt;/P&gt;&lt;P&gt;Load *;&lt;/P&gt;&lt;P&gt;SQL Declare&lt;/P&gt;&lt;P&gt;....&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;set @fecha =&lt;/SPAN&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;$(vAñoInicio);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;... &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;YOUR SQL);&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 09 Mar 2018 17:58:36 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Trying-to-do-this-SQL-in-Qlik/m-p/83039#M784408</guid>
      <dc:creator>cristian_av</dc:creator>
      <dc:date>2018-03-09T17:58:36Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to do this SQL in Qlik</title>
      <link>https://community.qlik.com/t5/QlikView/Trying-to-do-this-SQL-in-Qlik/m-p/83040#M784409</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The thing i need to do is that Qlik can run that query because i want to do a report with the data that this query gives me...&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 09 Mar 2018 18:56:00 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Trying-to-do-this-SQL-in-Qlik/m-p/83040#M784409</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-03-09T18:56:00Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to do this SQL in Qlik</title>
      <link>https://community.qlik.com/t5/QlikView/Trying-to-do-this-SQL-in-Qlik/m-p/83041#M784410</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I think this is store procedure, right ?&lt;/P&gt;&lt;P&gt;if SP,&lt;/P&gt;&lt;P&gt;SET NOCOUNT ON;&lt;/P&gt;&lt;P&gt;Load *,&lt;/P&gt;&lt;P&gt;SQL EXEC SP_Name;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this works..!!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 12 Mar 2018 07:21:34 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Trying-to-do-this-SQL-in-Qlik/m-p/83041#M784410</guid>
      <dc:creator>Nagaraju_KCS</dc:creator>
      <dc:date>2018-03-12T07:21:34Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to do this SQL in Qlik</title>
      <link>https://community.qlik.com/t5/QlikView/Trying-to-do-this-SQL-in-Qlik/m-p/83042#M784411</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Try&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Let @fecha=Date(Floor(Today())-1,'YYYY-MM-DD');&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;SQL&lt;/STRONG&gt; select max(FechaRecepcion ) as Fecha, max(so.sucursalnombre) as Sucursalorigen,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;e.TipoComprobante as TipoComp,sum(e.subtotal-e.descuento+e.iva+e.seguro) as ImporteTotal,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;max(sd.sucursalnombre) as SucursalDestino, iif(e.OrigenPago = 'D','DES','ORG') as OrgPago&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;from dbo.Envios e &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;inner join dbo.Sucursales so&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;on so.sucursalid = e.sucursalidorigen &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;inner join dbo.Sucursales sd&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;on sd.sucursalid = e.sucursaliddestino &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;left join dbo.Clientes co&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;on e.clienteidorigen = co.clienteid &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;left join dbo.Clientes cd&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;on e.clienteiddestino = cd.clienteid &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;left join dbo.Empleados ef&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;on e.empleadofacturacion = ef.empleadoid &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;where Fecharecepcion =&lt;STRONG&gt;'$(@fecha)'&lt;/STRONG&gt; and Anulado = 0 and Tipocomprobante is not null&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and SucursalIDEmision &amp;lt; 20 and SucursalIDDestino &amp;lt; 20 and Tipocomprobante IN ('FA', 'FB')&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;group by&amp;nbsp; so.sucursalnombre, e.TipoComprobante, OrigenPago, e.SucursalIDDestino;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 12 Mar 2018 07:43:26 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Trying-to-do-this-SQL-in-Qlik/m-p/83042#M784411</guid>
      <dc:creator>sasiparupudi1</dc:creator>
      <dc:date>2018-03-12T07:43:26Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to do this SQL in Qlik</title>
      <link>https://community.qlik.com/t5/QlikView/Trying-to-do-this-SQL-in-Qlik/m-p/83043#M784412</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks that solved my issue!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 12 Mar 2018 12:27:50 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Trying-to-do-this-SQL-in-Qlik/m-p/83043#M784412</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-03-12T12:27:50Z</dc:date>
    </item>
  </channel>
</rss>

