Jump to content

Joining tables help needed please


mp3lab

Recommended Posts

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 with

$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 asc";

 

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

Link to comment
https://forums.phpfreaks.com/topic/259657-joining-tables-help-needed-please/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.