Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Not applicable

How to implement sql query in the qlikview scripting

how to implement sql query

6 Replies
MVP
MVP

Re: How to implement sql query in the qlikview scripting

You can use the same sql query as it is in qv and fetch using 'SQL' command data like:

SQL <your query>;

Not applicable

Re: How to implement sql query in the qlikview scripting

No it is not working it is showing error

MVP
MVP

Re: How to implement sql query in the qlikview scripting

It works. If you are getting error, it has to be something with your approach. What is the error message you are getting?

MVP
MVP

Re: How to implement sql query in the qlikview scripting

Hi,

You need to give ; before the SQL keyword instead of comma.

Try like this

LOAD

*;

SQL SELECT tab.*, Round((DateDiff("h",startdate,enddate)/24)-DateDiff("ww",startdate,enddate,1)-DateDiff("ww",startdate,enddate,7),2) AS durationdays, Round((DateDiff("n",startdate,enddate))-DateDiff("ww",startdate,enddate,1)*1440-DateDiff("ww",startdate,enddate,7)*1440,2) AS durationmin

FROM (SELECT [defect id], [New Value], [old value], [Change Date/Time] AS startdate, (SELECT TOP 1 [change date/time] FROM status_history next WHERE [defect id] = new.[defect id] and [Change Date/Time] > new.[Change Date/Time]  and [old Value]=new.[New Value] order by [Change Date/Time]) AS enddate, (SELECT TOP 1 [new value] FROM status_history next WHERE [defect id] = new.[defect id] and [Change Date/Time] > new.[Change Date/Time] and [old Value]=new.[New Value] order by [Change Date/Time]  ) AS nextValue FROM status_history AS new WHERE [changed field]='BG_STATUS')  AS tab;

Regards,

Jagan.

Not applicable

Re: How to implement sql query in the qlikview scripting

i need write the script for it in qlikview no connection from sql.

Re: How to implement sql query in the qlikview scripting

As far as the concern about the excel data load use the ODBC connection for excel otherwise a way that you can load directly data from the excel files.

Load Fields...

From Location;

Community Browser