Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Discover how organizations are unlocking new revenue streams: Watch here
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Query required

Hi,

i have a SQL query which refer to the same table. kindly help me you do i write this query in QV.

SELECT distinct a.icall_no AS call_no,a.machine_no,

       DECODE (a.machine_status,

               201, 'QUALIFIED CALL',

               202, 'QUALIFIED CALL',

               203, 'NQ APPROVED CALL',

               204, 'NQ APPROVED CALL',

               284, 'NM APPROVED CALL'

              ) AS call_type,

       b.region AS region,

       b.loc_num AS location

 

  FROM calldetail a, calldetail b

WHERE a.icall_no = b.icall_no

   AND a.status = 38

   AND a.call_date >= '03-aug-2009'

   AND a.call_date < '10-aug-2009'

   AND a.call_no <> b.call_no

2 Replies
Anonymous
Not applicable
Author

Does it work if you just wrap it with SQL and ; ?

SQL

SELECT distinct a.icall_no AS call_no,a.machine_no,

...

WHERE a.icall_no = b.icall_no

   AND a.status = 38

   AND a.call_date >= '03-aug-2009'

   AND a.call_date < '10-aug-2009'

   AND a.call_no <> b.call_no

;

kaushiknsolanki
Partner Ambassador/MVP
Partner Ambassador/MVP

HI,

     Try this.

     DATA:

     Load region,loc_num,.icall_no, call_no from calldetail.qvd(qvd);

     join

     Load icall_no ,.machine_no,

     if(match(machine_status,'201','202'),'QUALIFIED CALL',

          if(match(machine_status,'203','204'),'NQ APPROVED CALL',

               if(match(machine_status,'284'),'NM APPROVED CALL'))) as call_type

     From calldetail.qvd(qvd)

     where Status = 38 and call_date >= makedate(2009,08,03) and call_date <  makedate(2009,08,10)

     and not exisits(call_no,call_no);

Regards,

Kaushik Solanki

Please remember to hit the 'Like' button and for helpful answers and resolutions, click on the 'Accept As Solution' button. Cheers!