0

我有这个问题。

我需要从我的匹配表中获取这些字段:

date, points

然后epos_id我的匹配表中也有一个字段..

我有另一个rbpos_epos表,其中有epos_idlocation字段。

我需要locationrbpos_epos 使用连接中获取 .. 是这样的:

SELECT matching.date, matching.points, matching.time,matching.location,matching.epos_id,rbpos_epos.epos_id,rbpos_epos.location
FROM matching  WHERE matching.user_id="'.$id_user.'"
LEFT JOIN rbpos_epos where matching.epos_id=rbpos_epos.epos_id; 
4

3 回答 3

0

使用 on 代替 -

    SELECT matching.date, matching.points, matching.time,matching.location,matching.epos_id,rbpos_epos.epos_id,rbpos_epos.location
   FROM matching LEFT JOIN rbpos_epos ON matching.epos_id=rbpos_epos.epos_id      
      WHERE matching.user_id="'.$id_user.'";
于 2013-01-04T11:02:19.270 回答
0

试试这个:

SELECT m.date, m.points, m.time,m.location,m.epos_id,re.epos_id,re.location
FROM matching  m 
LEFT JOIN rbpos_epos re ON m.epos_id=re.epos_id
WHERE m.user_id= 10
于 2013-01-04T11:05:17.410 回答
0
SELECT 
    first_table.date,
    first_table.points,
    first_table.time,
    first_table.location,
    first_table.epos_id,
    rbpos_epos.epos_id,
    rbpos_epos.location
FROM
    first_table
LEFT JOIN
    rbpos_epos ON first_table.epos_id = rbpos_epos.epos_id
WHERE
    first_table.user_id = "'.$id_user.'";
于 2013-01-04T11:07:15.857 回答