Hello Folk,
I am new to SQL and I am trying to Join two table date. One date is organization date and another date I have in data. I want to align both data like lookup.
This is my current statement:
SELECT * FROM SC_ODS.TAR_MOVE_ST t10
WHERE CARRIER_ID IN
('PINNACL_60', 'PINNACL_28','PINNACL_61','PINNACL_SCA','PINNACL_OW')
JOIN ba_tmextra.cal_dt cal on trunc(tl0.START_DATE)
AND
START_DATE BETWEEN to_DATE ('01-OCT-2022' ,'DD-MM-YYYY') AND tO_DATE ('28-FEB-2023', 'DD-MM-YYYY')
Can someone tell me how can I correct so that both date marge or lookup?
your code does not look correct ? maybe copy paste issue
SELECT
*
FROM
SC_ODS.TAR_MOVE_ST t10
JOIN
ba_tmextra.cal_dt cal
ON
trunc(tl0.START_DATE) ????? == something is missing here
WHERE
CARRIER_ID IN
( 'PINNACL_60'
,'PINNACL_28'
,'PINNACL_61'
,'PINNACL_SCA'
,'PINNACL_OW')
AND
START_DATE BETWEEN
to_DATE ('01-OCT-2022' ,'DD-MM-YYYY')
AND
tO_DATE ('28-FEB-2023', 'DD-MM-YYYY' )
Typically it looks like this
ON table1.colA = table2.ColB