我正在使用连接查询并将结果作为图像3中的快照。使用以下查询
SELECT c.* , p.*
FROM T1 c right join T2 p ON c.id=p.stu_id
WHERE c.id=8
实际上我不希望T1的重复结果为
答案 0 :(得分:1)
=>尝试此查询。
$select = "SELECT C.id as fildname
FROM table_name as T
JOIN table_name as C
ON T.id = C.fildname
WHERE B.id=".$Tid;
$result = mysql_query($select) or die (mysql_error());
$row = mysql_fetch_array($result);
OR
//get one to many fild ...
$sql = "SELECT B.firstname as user_name,
B.lastname as Lastname,
B.email as Email,
B.phone as Phone,
B.address as Address, B.city as City,
B.state as State,
B.pincode as Pincode ,V.firstname as
vehicle_name,V.lastname as Vlastname,
V.email as Vemail,V.phone as Vphone,
V.address as Vaddress,
V.city as Vcity, V.state as Vstate,
V.pincode as Vpincode
FROM broker_table as B , vehicle_table as V
where B.id='".$row['c_id']."'";