Joining tables help needed please
Posted: Sat Mar 24, 2012 6:06 pm
Hi
As I'm new to PHP/MySQL
I need a little help concerning joining 4 tables in SQL query.
I have 4 tables
first is asort with 4+ columns
id catid pid tipid ...
id is primary key and catid, pid and tipid are foreign keys from tables kategorija, proizvod and tip
I want to make a query to join this 4 tables and find for example all rows with pid=4
I tryed withc";
but I got
"Column 'tipid' in where clause is ambiguous"
Thank you for reading this especially if you are able to help me out on this.
Bye
DVAL
As I'm new to PHP/MySQL
I need a little help concerning joining 4 tables in SQL query.
I have 4 tables
first is asort with 4+ columns
id catid pid tipid ...
id is primary key and catid, pid and tipid are foreign keys from tables kategorija, proizvod and tip
I want to make a query to join this 4 tables and find for example all rows with pid=4
I tryed with
Code: Select all
$q1 = "SELECT * FROM asort LEFT JOIN (kategorija, proizvod, tip)
ON (kategorija.catid=asort.catid AND proizvod.pid=asort.pid AND tip.tipid=asort.tipid)
where tipid='$_GET[tipid]' order by cijena asbut I got
"Column 'tipid' in where clause is ambiguous"
Thank you for reading this especially if you are able to help me out on this.
Bye
DVAL