I have an SQL query that loads data from a link server that returns Oracle data but I am having trouble filtering by sysdate. When I dont filter all data is returned but I just need the data for the previous day. What am I doing wrong here?
select S.* from openquery(LOTOS, 'SELECT RET_CD, GM_CD, GM_VAR, DRAW_CD, LOTOS_CD, GRS_AMN, CMS, CPNS, DT FROM LOTOSMIS.RET_DAILY WHERE RET_CD=14043 and DT = SYSDATE-4') S
select S.* from openquery(LOTOS, 'SELECT RET_CD, GM_CD, GM_VAR, DRAW_CD, LOTOS_CD, GRS_AMN, CMS, CPNS, DT FROM LOTOSMIS.RET_DAILY WHERE RET_CD=14043 and DT = SYSDATE-4') S