August 29, 2010 at 2:58 am
I HAVE TWO TABLE VOTERID and Deathtable
Voter id table has the following field
ISNID, Name,City,Alive
I have attached the voterid table
I wanted to extract the value from voterid where alive='NO'
and add it into deathtable if not exists... if already exists leave it..
I have used the below query:
INSERT INTO DEATHTABLE (ISNID)
SELECT ISNID FROM VOTERID WHERE ALIVE='NO' WHERE ISNID NOT IN (SELECT ISNID FROM DEATHTABLE)
i am getting the below error.
Incorrect syntax near the keyword 'WHERE'.
Where my query gets errror... please help me...
August 29, 2010 at 4:03 am
Hi Write like ---
INSERT INTO DEATHTABLE (ISNID)
SELECT ISNID FROM
VOTERID WHERE ALIVE='NO'
AND ISNID NOT IN (SELECT ISNID FROM DEATHTABLE)
August 29, 2010 at 11:14 pm
Thanks... i'll try this and let you know...
August 9, 2012 at 12:33 am
INSERT INTO DEATHTABLE (ISNID)
SELECT d.ISNID FROM VOTERID v
LEFT JOIN DEATHTABLE d
ON d.ISNID=v.ISNID
WHERE v.ALIVE='NO'
and s.ISNID is null
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply