我有4個表:SQL多表查詢工作緩慢
bag_of_words(
ch_id,
frequency,
number,w_id
)
clinical_history(
ch_complete,
ch_id,p_id
)
patients(
p_id,
p_name
)
words(
w_id,
w_word
)
和我有選擇的單詞列表。我需要從表w_word
,p_name
,number
,freqency
和ch_id
中選擇。
我有這個疑問,但它是緩慢的,我需要的是更快
SELECT
w_word,
p_name,
number,
frequency,
bag_of_words.ch_id
FROM
bag_of_words
LEFT JOIN
words
ON
words.w_id=bag_of_words.w_id
LEFT JOIN
clinical_history
ON
bag_of_words.ch_id=clinical_history.ch_id
LEFT JOIN
patients
ON
patients.p_id=clinical_history.p_id
WHERE
words.w_word IN (',,,,,')
我認爲沒有加入,它會工作得很快,但我找不到方法。 – user2605046
使用索引概念 –