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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.