我正在尝试运行以下语句,并且我一直收到错误声明 - " SQL命令未正确结束"。我不确定我做错了什么或我错过了什么?任何帮助是极大的赞赏 。我确实在没有最后一次加入的情况下运行了语句并且它运行得很完美,但是一旦我添加了" icue.mbr_adr mb"桌子我收到了一个错误。
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'
答案 0 :(得分:0)
这是我做的,它的工作原理。再次感谢PKatona。我刚刚把Where改成了“AND”
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
AND 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