Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8861493
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T15:30:15+00:00 2026-06-14T15:30:15+00:00

Possible Duplicate: MySQL #1054 unknown column I need a query that will pull only

  • 0

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!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T15:30:16+00:00Added an answer on June 14, 2026 at 3:30 pm

    Don’t mix comma notation for joins and explicit join notation, you’ll loose access to some of your alias names. If you don’t have access to the alias, you can’t refer to its columns. I’m assuming groups has a column id

    Also, as noted elsewhere, I suggest you use a different name for your label ‘default_printer’ while you troubleshoot this and for clarity.

    SELECT c.id, c.name, p.name the_default_printer, c.description
       FROM computers c
       INNER JOIN groups g  ON g.id = c.guid
       INNER JOIN printers p
         ON g.default_printer = p.id OR c.default_printer = p.id
      WHERE p.name LIKE 'mfd%'
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Possible Duplicate: MySQL date format i have this date which i need to make
Possible Duplicate: MySQL retrieve latest record for Group I have a query that groups
Possible Duplicate: mysql case sensitive query 'm working on an PHP script that checks
Possible Duplicate: mysql count into PHP variable I have the following query that returns
Possible Duplicate: MySql select format, round column When i make a SQL query using
Possible Duplicate: php/Mysql query with inserting date fails I have a datepicker code below:
Possible Duplicate: mySQL “Rank in Highscore”-Query I was just wondering if there is any
Possible Duplicate: MySQL LIMIT/OFFSET: get all records except the first X Ok I do
Possible Duplicate: MySQL query using an array How to use an array of values
Possible Duplicate: Mysql single query join 3 table and get all the results Hi

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.