1 Reply Latest reply on Jun 29, 2015 6:53 AM by Wilson Smith

    Implementing subquery in 9.0

    Wilson Smith

      Hello experts,

       

      Is there anyway to build the below SQL query in tableau without using custom SQL? May be LOD?

       

      SELECT b.country,a.store_id, b.store_ds,a.vis_date, a.ques_nu, a.sc_nu

      FROM schema.vis_ansr a

      JOIN

      (SELECT c.country,a.store_id,,b.store_ds,a. vis_date, a.vis_in_tm

                          FROM schema.vis_ansr a

                          JOIN schema.lcat b ON a.store_id=b.store_id

                          JOIN schema.ctry c ON c.ctry_id=b.ctry_id

                          WHERE a.ques_nu = 58 AND

                           a.rspn_ds = 'kiosk'

                          AND a.store_id in (select store_id from schema.LCAT where CTRY_ID in ('724','250','528'))

      ) b

      ON a.store_id = b.store_id

      AND a.vis_date = b.vis_date

      AND a.vis_in_tm = b.vis_in_tm

      WHERE ques_nu IN (30, 31)

      AND a.pnt_psbl_qt > 0

      AND a.store_id in (select store_id from schema.LCAT where CTRY_ID in ('724','250','528'))

       

      Thanks,