How to implement this program for importing into a table without using the INSERT INTO SELECT Statement?

前端 未结 1 1025
野的像风
野的像风 2021-01-29 07:44

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

相关标签:
1条回答
  • 2021-01-29 08:18

    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.

    0 讨论(0)
提交回复
热议问题