Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Santosh
Contributor III
Contributor III

SQL script in qlikview

Hi All,

I am new to qlikview please help me to implement below script in qlikview.

SELECT t.P_id, t.C_id, t.C_date, t.C_score
FROM temp t
INNER JOIN (SELECT P_id, C_id, Max(C_date) AS mdate, C_score
FROM temp
WHERE C_date >= "2018-11-17" and C_date <= "2018-11-20"
GROUP BY P_id) AS a
ON a.P_id = t.P_id AND a.mdate = t.C_date 

Labels (3)
1 Reply
lblumenfeld
Partner Ambassador
Partner Ambassador

Assuming that the SQL query you listed works, use the following

Load
     P_id,
     C_id,
     C_date,
     C_score;
SQL SELECT t.P_id, t.C_id, t.C_date, t.C_score

FROM temp t
INNER JOIN (SELECT P_id, C_id, Max(C_date) AS mdate, C_score
FROM temp
WHERE C_date >= "2018-11-17" and C_date <= "2018-11-20"
GROUP BY P_id) AS a
ON a.P_id = t.P_id AND a.mdate = t.C_date ;


If you want to change any field names in your Qlik model then use "as" (I made up an example below).

Load
     P_id as [Person ID],

... etc.

Don't forget the ";" after the load statement and the SQL statement, or you'll get an error. Note that your "Select" statement is now receded by the word "SQL".

 

Enjoy.