4 Replies Latest reply on Nov 18, 2013 1:57 PM by Paul Ozule

    Need help with a Custom SQL command

    Paul Ozule

      Hello – I need help writing a custom SQL that requires multiple joins. I have 3 data source tables ([2013_11_CALL_DETAIL_RECORD],  [2013_11_CSI_APPDATA], [2013_11_CSI_APPDATA_EXT]). The “APP_LOG_ID” is the primary key on [2013_11_CALL_DETAIL_RECORD] and the foreign keys on the other tables. Here is an example of what I use in SQL Server Management Studio:


      select * from [2013_11_call_detail_record] cdr , [2013_11_csi_appdata] ap, [2013_11_csi_appdata_ext] ext, [2013_11_csi_checkpoint] chk

      where cdr. app_log_id = ap .app_log_id and

            cdr . app_log_id = ext .app_log_id and

            cdr . app_log_id = chk .app_log_id and

            user_defined_fld3 = 'asrnt' and

            call_start_tstamp >= '11/15/2013' and

            call_start_tstamp < '11/18/2013'


      How can I replicate this using custom SQL and can I use a “UNION ALL” clause to add subsequent months?