lrk889 lrk889 - 4 months ago 7
SQL Question

SQL command not properly ended - creating table

I am receiving the error


SQL COMMAND NOT PROPERLY ENDED


for the following piece of code:

CREATE TABLE klisa.min_invlv_strt_dt AS

SELECT cas_id
,min(invlv_strt_dt) min_invlv_strt_dt
FROM kids.tcas_clnt_invlv_hist
WHERE invlv_end_dt IS NULL = --and cas_id = 63878
GROUP BY cas_id
ORDER BY cas_id;


Any help would be greatly appreciated

Answer
WHERE invlv_end_dt IS NULL = --and cas_id = 63878

Formatting your query highlights (literally) the issue. You have your -- comment after an =, causing the error.

It should be this instead:

WHERE invlv_end_dt IS NULL --and cas_id = 63878

(I'm assuming you intended to comment out the AND clause)

Comments