Question : MySQL Select Statement -  join causing Ambiguous Error

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 "


Code Snippet:
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
SELECT  
taskname
IFNULL(A.taskgroup, '[None Assigned]'),
taskunit,
C.division
 
FROM B
 
LEFT JOIN A USING(taskgroup_id)
LEFT JOIN C USING(division_id)
 
WHERE task_id = etc
Open in New Window Select All

Answer : MySQL Select Statement -  join causing Ambiguous Error

1:
2:
3:
4:
5:
6:
SELECT  taskname, IFNULL(A.taskgroup, '[None Assigned]'),taskunit,C.division
 FROM B
 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 Select All
Random Solutions  
 
programming4us programming4us