Currently the import/insert process is working perfectly. But I don\'t want to write a single query for both inserting and selecting but rather write a separate query for select
You can (and should) include the concept-id-selecting query within an IN
clause:
INSERT INTO snomedinfo_data (refid, id, effectivetime, active, moduleid, conceptid,
languagecode, typeid, term, caseSignificanceid)
SELECT refid, id, effectivetime, active, moduleid, conceptid,
languagecode, typeid, term, caseSignificanceid
FROM snomed_descriptiondata
WHERE active = 1 AND conceptid IN
(SELECT cd.id FROM snomed_conceptdata cd WHERE cd.active = 1)
This way you should be able to do everything in one statement which will be orders of magnitude faster than processing the same data row-by-row (a.k.a slow-by-slow) by the JDBC driver.