php - 从三个表中获取特定列

标签 php mysql database mysqli phpmyadmin

我需要通过连接从三个表中获取特定列。每次都会出错。我的代码是

    $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/

相关文章:

mysql - 通过批处理文件启动 MySQL 脚本文件

database - HBase区域中的数据可以根据family:column的值手动进行排列

php - 生成数字组合

php - 在 PHP 中处理两个 mysql 连接

Php 电子邮件表单请求信息

mysql - 获取特定列中期望的所有 id

php - PDO 从表中提取一列到一维数组中

php - 欧元符号未在 HTML 中正确显示

ios - 在 Phonegap iOS 应用程序中使用预填充数据库

mysql - 学校数据库标准化会带来更好的性能吗