Wednesday 10 December 2014

SQLite 3 query for insert into table if id not exist in some other table

INSERT INTO tbl_img_upload_queue11  (galleryID, galleryURL,imgUniqueName, imgTime, imgLat, imgLong, uploadStatus)
SELECT id, galleryURL, imgUniqueName, imgTime, imgLat, imgLong, "0" as uploadStatus FROM tbl_gallery_img as tb Where id not in (select galleryid from tbl_img_upload_queue11 where tb.id<>id) and id in(1,2,3,4)


No comments:

Post a Comment