Possible Duplicate:
MySQL #1054 unknown column
I need a query that will pull only records which match the user provided search query. The tricky part is that the information that the user is searching for is in another table. My application is pulling records from a table called 'computers'. Inside 'computers' there's a column that has an ID number of a printer (default_printer). All of the printer information such as name (which the user is searching for) is inside the 'printers' table which the user is searching for.
So naturally I need to list all computer information but at the same time resolve the ID inside the 'computers' table to the name inside the 'printers' table. Here's the query that I've come up with so far:
SELECT c.id, c.name, p.name default_printer, c.description
FROM computers c, groups g
INNER JOIN printers p
ON g.default_printer = p.id OR c.default_printer = p.id
WHERE p.name LIKE 'mfd%'
The problem is I'm getting the error: #1054 - Unknown column 'c.default_printer' in 'on clause'. The 'computers' table has a column called 'default_printer'.
Here's my table schema:
Table name: computers
Columns: id, name, description, default_printer, report_date, guid
Table name: printers
Columns: id, name, path, location, description
Table name: groups
Columns: id, name, description, default_printer
I'm stuck, help!