我有以下查詢: $stmt = $conn->query("SELECT * FROM research as r LEFT JOIN research_participants as rp ON rp.research_no = r.id LEFT JOIN researcher as rc ON rc.id = rp.researcher_id where r.id = $researchid");這個查詢工作得很好,但是,我希望它只選擇狀態(tài)=“完成”的研究,所以我將其更改為以下內(nèi)容:$stmt = $conn->query("SELECT * FROM research WHERE status= 'done' as r LEFT JOIN researcher as rp ON r.researcher_id = rp.id");不幸的是,它不起作用。我還嘗試了以下方法: $stmt = $conn->query("SELECT * FROM research as r LEFT JOIN researcher as rp ON r.researcher_id = rp.id WHERE status= 'done'");但即使這樣也行不通。研究表如下所示: 在此處輸入圖像描述
添加WHERE子句后sql不起作用
叮當(dāng)貓咪
2023-11-03 21:24:40