MySQL Select Statement -  join causing Ambiguous Error

Posted on 2009-05-25
Medium Priority
Last Modified: 2012-08-14
Hi  hopefully there's an easy fix to this  - I think there will be  I have three tables A, B, C

I am running a select statement from table B.

I left join to table A on a common variable (taskgroup_id)  all good

I left join to C on a common variable  but because this variable is in all 3 tables (i thihk this is why)  I am getting an error "Column 'division_id' in from clause is ambiguous "

IFNULL(A.taskgroup, '[None Assigned]'),
LEFT JOIN A USING(taskgroup_id)
LEFT JOIN C USING(division_id)
WHERE task_id = etc

Open in new window

Question by:j-b-t
LVL 14

Accepted Solution

racek earned 2000 total points
ID: 24470558

SELECT  taskname, IFNULL(A.taskgroup, '[None Assigned]'),taskunit,C.division
 LEFT JOIN A on B.taskgroup_id = A..taskgroup_id
LEFT JOIN C on C.division_id = B.division_id
WHERE task_id = etc

Open in new window

LVL 11

Author Closing Comment

ID: 31585184
Great thanks

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

How much do you know about the future of data centers? If you're like 50% of organizations, then it's probably not enough. Read on to get up to speed on this emerging field.
The title says it all. Writing any type of PHP Application or API code that provides high throughput, while under a heavy load, seems to be an arcane art form (Black Magic). This article aims to provide some general guidelines for producing this typ…
This is a high-level webinar that covers the history of enterprise open source database use. It addresses both the advantages companies see in using open source database technologies, as well as the fears and reservations they might have. In this…
Hi, this video explains a free download that you can incorporate into your Access databases, or use stand-alone for contact management. Contacts -- Names, Addresses, Phone Numbers, eMail Addresses, Websites, Lists, Projects, Notes, Attachments…

627 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question