我試圖通過執行以下查詢的PHP應用程序來填充表:SQL錯誤在PHP返回的查詢與聯接
$sql3 = "SELECT distinct(`t1.testName`), `t2.comments AS C1` from `sample AS t1` left join `sample AS t2` ON `t1.testName`= `t2.testName` where `t1.buildNumber`= 181 and `t2.buildNumber`= 180 and `t1.errorStackTrace` is not null";
$result3 = mysqli_query($dbconnect,$sql3);
if(!mysqli_query($dbconnect, $sql3)){
printf("error message: %s\n",mysqli_error($dbconnect));
}
我看到下面的錯誤返回:
error message: Table 'testdata.sample as t1' doesn't exist
我已經嘗試了很多來解決這個問題,但不能。在MySQL上運行時查詢運行良好。 任何幫助,將不勝感激。 謝謝
使用適當的反引號或從示例AS t1中刪除'$ sql3 =「SELECT distinct(t1.testName),t2.comments AS C1 left left join sample AS t2 ON t1.testName = t2.testName其中t1.buildNumber = 181和t2.buildNumber = 180和t1 .errorStackTrace不爲空「; ' –