0
我具有中間表:由更新替換選擇表
text_mining_molecule
|text_mining_id| molecule_id |
| -------------| ---------- |
| ID | ID |
和其他兩個表:
表分子:
id | main_name | others …
--- | --------- | ------
1 | caféine | others …
表jsonTextMining:
id | title | molecule_name | others …
---|------- |-------------------------------------|------
1 | title1 | colchicine, cellulose, acid, caféine| others …
text_mining_molecule
需要被插入時,從2個人桌json_text_mining
和molecule
在列表中選擇與ID的選擇。
其實,有一個已經從json_text_mining
插入所有行text_mining
4.
INSERT INTO text_mining (id, solrid, originalpaper, annotatedfile, title, keyword, importantsentence, version, klimischscore, moleculename, synonymname, validation)
SELECT id, solrid, originalpaper, annotatedfile, title, keyword, importantsentence, version, klimischscore, molecule_name, synonym_name, validation
FROM json_text_mining WHERE klimischscore < 4
這工作,但我需要text_mining_molecule
要與相關的ID也充滿所以我也這樣下選擇一個分數時,下拉部分代碼:
SELECT s.id, m.id
FROM (SELECT id, regexp_split_to_table(molecule_name,', ') AS m_name
FROM json_text_mining) AS s, molecule m
WHERE m.main_name = s.m_name;
我怎麼能直接更新text_mining_molecule
表與insert
而不是select
?
一些FK ..什麼是text_mining_molecule和s.id之間的關係,m.id .. –
'json_text_mining'是一個臨時表,其中所有的文章都是?等待驗證。當有人點擊一個驗證按鈕時,'json_text_mining'文章被拷貝到'text_mining'表中,但是中間表中的關係不存在 – Gy0m
那麼您需要插入,而不是更新? –