List:General Discussion« Previous MessageNext Message »
From:Larry Martell Date:December 12 2012 5:16pm
Subject:Re: Help with left outer join
View as plain text  
On Tue, Dec 11, 2012 at 8:48 PM, Peter Brawley
<peter.brawley@stripped> wrote:
>>ERROR 1054 (42S22): Unknown column 'data_tool.category_id' in 'on clause'
>>But category_id is a column in data_tool.
>
> Then a bit of reordering is required ...
>
> SELECT data_target.name, ep, wafer_id, lot_id,
>        date_time, data_file_id, data_cstimage.name,
>        bottom, wf_file_path_id, data_measparams.name,
>        vacc, data_category.name
> FROM data_cst
> RIGHT JOIN data_cstimage   ON data_cstimage.id = data_cst.image_measurer_id
> INNER JOIN data_tool       ON data_tool.id = data_cst.tool_id
> INNER JOIN data_target     ON data_target.id = data_cst.target_name_id
> INNER JOIN data_measparams ON data_measparams.id =
> data_cst.meas_params_name_id
> INNER JOIN data_category   ON data_category.id = data_tool.category_id
> WHERE data_cst.target_name_id IN (38018, 29947, 28330)
>   AND data_cst.date_time BETWEEN '2012-09-01 00:00:00' AND '2012-09-07
> 00:00:00'
> ORDER BY target_name_id, ep, wafer_id, lot_id, date_time;

Your query worked exactly like my original one - i.e. when
data_cst.image_measurer_id is NULL I don't get that data_cst row. But
I changed the RIGHT JOIN to a LEFT JOIN and then it was doing exactly
what I wanted. Thanks for all the help!

> On 2012-12-11 5:11 PM, Larry Martell wrote:
>
> SELECT data_target.name, ep, wafer_id, lot_id,
>>
>>        date_time, data_file_id, data_cstimage.name,
>>
>>        bottom, wf_file_path_id, data_measparams.name,
>>
>>        vacc, data_category.name
>>
>> FROM data_cst
>>
>> RIGHT JOIN data_cstimage   ON data_cstimage.id =
>> data_cst.image_measurer_id
>>
>> INNER JOIN data_target     ON data_target.id = data_cst.target_name_id
>>
>> INNER JOIN data_measparams ON data_measparams.id =
>> data_cst.meas_params_name_id
>>
>> INNER JOIN data_category   ON data_category.id = data_tool.category_id
>>
>> INNER JOIN data_tool       ON data_tool.id = data_cst.tool_id
>>
>> WHERE data_cst.target_name_id IN (38018, 29947, 28330)
>>
>>    AND data_cst.date_time BETWEEN '2012-09-01 00:00:00' AND '2012-09-07
>> 00:00:00'
>>
>> ORDER BY target_name_id, ep, wafer_id, lot_id, date_time;
>
> Thanks very much for the reply. This is giving me:
>
> ERROR 1054 (42S22): Unknown column 'data_tool.category_id' in 'on clause'
>
> But category_id is a column in data_tool.
>
>
>
Thread
Help with left outer joinLarry Martell11 Dec
  • Re: Help with left outer joinPeter Brawley11 Dec
    • Re: Help with left outer joinLarry Martell11 Dec
      • Re: Help with left outer joinPeter Brawley12 Dec
        • Re: Help with left outer joinLarry Martell12 Dec
  • Re: Help with left outer joinhsv12 Dec
    • Re: Help with left outer joinShawn Green12 Dec
      • Re: Help with left outer joinLarry Martell12 Dec
      • Re: Foreign-key naminghsv12 Dec
    • Re: Help with left outer joinLarry Martell12 Dec