我需要通过连接从三个表中获取特定列。每次都会出错。我的代码是
$saf=mysqli_query($db , "select pod.mobile, tpaidamount.Aptdate, follow.cent, pdate, time from pod,tpaidamount, follow where tpaidamount.pid = follow.pid and pod.Customer Id = tpaidamount.pid and pod.Customer Id =follow.pid ");
$i=1;
while($sfg=mysqli_fetch_assoc($saf) or die(mysqli_error($db)))
;
?>
pod,tpaidamount,follow are tables and other coloumns
出现错误 您的 SQL 语法有错误;检查与您的 MySQL 服务器版本相对应的手册,了解在第 1 行“Id = tpaidamount.pid and pod.Customer Id =follow.pid”附近使用的正确语法
最佳答案
是不是打错了?是setfollowup.pid还是follow.pid?
select pod.mobile, tpaidamount.Aptdate, follow.cent, <table>.pdate, <table>.time
from pod, tpaidamount, follow
where tpaidamount.pid = follow.pid
and pod.`Customer Id` = tpaidamount.pid
and pod.`Customer Id` = follow.pid
关于php - 从三个表中获取特定列,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45156805/