How can trace two column in single sql query(logstash)

Dear All.

i have sql query that contain union operation with different join and table.

SELECT DISTINCT S.HEALTHRECORDKEY,NULL PRODUCTCODE,S.FIRSTNAME,S.LASTNAME,NULL DRUGDESCRIPTION,
PUL.LABTEST_TYPE_DESC,PUL.LABTEST_DATE, PUL.DIAG_SERVICE_LOCATION,PUL.LABTEST_RESULT_DATE , PUL.LABTEST_ID,null
FROM EDW.CONSENT.BENEFICIARY_DETAILS S
INNER JOIN CDR.PHR_USER_HOSPITALIZATION PU ON S.HEALTHRECORDKEY = PU.HEALTHRECORDKEY
INNER JOIN CDR.ORDER_INFO OI ON PU.HOSPITALIZATION_ID = OI.HOSPITALIZATION_ID
INNER JOIN CDR.PHR_USER_LABTEST PUL ON OI.ORDER_ID = PUL.ORDER_ID
UNION -------------------------------
SELECT DISTINCT S.HEALTHRECORDKEY,PRODUCTCODE,S.FIRSTNAME,S.LASTNAME,DRUGDESCRIPTION,NULL,NULL,NULL,NULL , null,pm.id as id
FROM EDW.CONSENT.BENEFICIARY_DETAILS S
INNER JOIN EDW.CDR.ERX_PATIENT_MEDICATION PM ON S.HEALTHRECORDKEY = PM.HEALTHRECORDKEY"

Note :- how can i get only latest data from sql server into elastic search.

there is two unique column in this query:-
LABTEST_ID (first query)
union
pm.id as id(second query).
i tried with below:-

tracking_column => "id"
use_column_value => true
schedule => "*/5 * * * * *"

[2019-10-07T13:15:41,599][WARN ][logstash.inputs.jdbc ] tracking_column not found in dataset. {:tracking_column=>"id"}

please help me for this issue.

Thanks
HadoopHelp

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.