0

我收到此错误:

关键字“INNER”附近的语法不正确。标签“计数”已被声明。标签名称在查询批处理或存储过程中必须是唯一的。

我的查询是:

SELECT MAX(PatDiseasTreatment_tbl.improvement_rate) disease_tbl INNER
JOIN PatDiseasTreatment_tbl ON disease_tbl.disease_id =
PatDiseasTreatment_tbl.disease_id INNER JOIN  patient_tbl ON
PatDiseasTreatment_tbl.patient_id = patient_tbl.patient_id INNER JOIN
treatment_tbl ON PatDiseasTreatment_tbl.treatment_id =
treatment_tbl.treatment_id WHERE disease_tbl.MDdisease_name = " +
comboBox2 + " AND patient_tbl.age = " + comboBox1;

我不知道错误是什么以及如何解决。

4

3 回答 3

1

正确的格式是你的朋友:

SELECT MAX(PatDiseasTreatment_tbl.improvement_rate)
FROM disease_tbl
INNER JOIN PatDiseasTreatment_tbl ON disease_tbl.disease_id =
    PatDiseasTreatment_tbl.disease_id 
INNER JOIN  patient_tbl ON
    PatDiseasTreatment_tbl.patient_id = patient_tbl.patient_id
INNER JOIN treatment_tbl ON PatDiseasTreatment_tbl.treatment_id =
    treatment_tbl.treatment_id
WHERE disease_tbl.MDdisease_name = " +
comboBox2 + " AND patient_tbl.age = " + comboBox1;

你没有“FROM”

于 2013-06-08T05:59:38.860 回答
1

尝试这个

SELECT MAX(PatDiseasTreatment_tbl.improvement_rate) 
FROM  disease_tbl
INNER JOIN PatDiseasTreatment_tbl ON disease_tbl.disease_id =
    PatDiseasTreatment_tbl.disease_id 
INNER JOIN  patient_tbl ON
    PatDiseasTreatment_tbl.patient_id = patient_tbl.patient_id
INNER JOIN treatment_tbl ON PatDiseasTreatment_tbl.treatment_id =
    treatment_tbl.treatment_id
WHERE disease_tbl.MDdisease_name = " +
comboBox2 + " AND patient_tbl.age = " + comboBox1;
于 2013-06-08T06:02:58.613 回答
0

Ypu 需要在您的 select 语句中提及 from 子句。

SELECT MAX(PatDiseasTreatment_tbl.improvement_rate) disease_tbl FROM 'YOUR_TABLE_NAME)
INNER JOIN PatDiseasTreatment_tbl ON disease_tbl.disease_id =PatDiseasTreatment_tbl.disease_id INNER JOIN patient_tbl ON PatDiseasTreatment_tbl.patient_id = patient_tbl.patient_id INNER JOINtreatment_tbl ON PatDiseasTreatment_tbl.treatment_id =treatment_tbl.treatment_id WHERE disease_tbl.MDdisease_tbl = "+age 组合框组合框1;
于 2013-06-08T06:04:18.717 回答