i have a join query using 3 table but i get this problem Column 'id_f' in where clause is ambiguous
$id_f=$_GET['id_f'];
$query="SELECT *, s.name AS van, st.name AS naar, p.titl, p.vname
FROM p1_users, f_confirm AS v
INNER JOIN s_steden AS s ON v.van = s.id
INNER JOIN s_steden AS st ON v.naar = st.id
INNER JOIN p1_users AS p ON v.id_f = p.id_f
AND DATE_FORMAT(date,'%Y-%c-%d')WHERE id_f='$id_f'";
$result=mysql_query($query)or die('Wrong query : ' . mysql_error());
$row=mysql_fetch_assoc($result);
can anyone help?
You need to use
v.id_f
orp.id_f
in your where clause as two tables have a column of that name so you need to disambiguate.It actually doesn't matter which one you use in this case as you are doing an
inner join
.This might not be a requirement if you use a
natural join
but I don't suggest using these.