我试图通过执行以下查询的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不为空“; ' –