I am trying to run the below statement and I keep getting an error stating - "SQL Command not properly ended". I am not sure what I did wrong or what I am missing ? Any help is greatly appreciated . I did run the statement without the last join and it ran perfectly but as soon as I added the "icue.mbr_adr mb" table I got an error.
Select Distinct
cm.HSC_ID,
ac.creat_dttm,
cm.CNTC_NM,
cm.fax_nbr,
ac.actv_strt_dttm,
mb.st_cd
From icue.cmnct_trans cm
Inner Join icue.actv ac
On cm.HSC_ID = ac.HSC_ID
Where trunc(ac.actv_strt_dttm) between to_date('19-FEB-2018','DD-MON-YYYY') and to_date('06-MAR-2018','DD-MON-YYYY')
AND cm.FAX_NBR = '201-553-7889'
AND cm.CNTC_NM ='CHILDRENS HOSP PHILADELPHIA'
Inner Join icue.mbr_adr mb
On ac.mbr_id = mb.mbr_id
Where mb.st_cd ='PA' or 'NJ'
plsql
instead ofsql
. Please investigate the difference and tag your questions appropriately. – Michael O'Neillto_date('19-FEB-2018','DD-MON-YYYY')
can easily fail when setting the session to another language than English. Don't make your query that vulnarable. Use ANSI date literals instead:where ac.actv_strt_dttm >= date '2018-02-19' and ac.actv_strt_dttm < date '2018-03-07'
. – Thorsten Kettner