发布于 2022-03-05 18:41:40
尝尝这个
$where_clause = "";
if ($_SESSION["type"] == "encoder") $where_clause = " WHERE c.uid = '$uid'";
$sql = "
SELECT a.id, a.fname, a.lname, a.address, a.email, a.mobile, a.symptomps, b.name, a.processed FROM tblpatient a
INNER JOIN tblcenter b ON b.id = a.h_id
LEFT JOIN tbluserinfo c ON c.h_id = a.h_id
$where_clause
";基本上,您只需在select查询中添加b.name即可。
b.name意味着从b表中获取name列的值(在本例中,b是tblcenter表的别名)
https://stackoverflow.com/questions/71364863
复制相似问题