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 221149
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T19:00:22+00:00 2026-05-11T19:00:22+00:00

I have the following two tables: system – id – systemName – idOrganization organization

  • 0

I have the following two tables:

system
- id
- systemName
- idOrganization

organization
- id
- officeSymbol

I am running the following query and receiving an id is ambiguous error:

SELECT system.systemName, organization.officeSymbol
FROM system
LEFT JOIN (organization)
ON (system.idOrganization = organization.id)

As you can see, I’m not selecting the id column. If I place system.id within the list of fields to select, I no longer receive this error. Unfortunately, the manner in which this data is handled I can’t return the id – we don’t want it displayed to the user.

Also, if I add GROUP BY system.systemName I no longer get the error – but this just doesn’t seem like the optimal solution.

Note: The LEFT JOIN is intentional as not all systems will be assigned to an Organization.

SELECT VERSION()
--> 5.0.77-community-log

CREATE TABLE system (
  `id` INT(11) NOT NULL AUTO_INCREMENT,
  `systemName` VARCHAR(45) DEFAULT NULL,
  `idOrganization` INT(11) DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `fk_system_organization` (`idOrganization`),
  CONSTRAINT `fk_system_organization` 
    FOREIGN KEY (`idOrganization`) 
    REFERENCES `organization` (`id`) 
    ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

CREATE TABLE organization (
  `id` INT(11) NOT NULL AUTO_INCREMENT,
  `officeSymbol` VARCHAR(45) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
  • 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-05-11T19:00:23+00:00Added an answer on May 11, 2026 at 7:00 pm

    Tested on 5.0.77:

    
    SELECT  VERSION();
    
    VERSION()
    5.0.77
    
    
    CREATE TABLE organization (
      `id` INT(11) NOT NULL AUTO_INCREMENT,
      `officeSymbol` VARCHAR(45) DEFAULT NULL,
      PRIMARY KEY (`id`)
    ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
    CREATE TABLE system (
      `id` INT(11) NOT NULL AUTO_INCREMENT,
      `systemName` VARCHAR(45) DEFAULT NULL,
      `idOrganization` INT(11) DEFAULT NULL,
      PRIMARY KEY (`id`),
      KEY `fk_system_organization` (`idOrganization`),
      CONSTRAINT `fk_system_organization`
        FOREIGN KEY (`idOrganization`)
        REFERENCES `organization` (`id`)
        ON DELETE NO ACTION ON UPDATE NO ACTION
    ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
    
    INSERT
    INTO   organization
    VALUES
            (1, 'Organization 1'),
            (2, 'Organization 2');
    INSERT
    INTO     system
    VALUES  (1, 'System 1', 1),
            (2, 'System 2', 2);
    SELECT  system.systemName, organization.officeSymbol
    FROM    system
    LEFT JOIN
            (organization)
    ON      (system.idOrganization = organization.id);
    
    systemName      officeSymbol
    System 1        Organization 1
    System 2        Organization 2
    

    Everything works fine.

    Note that LEFT JOIN is useless here, since you have a FOREIGN KEY to organization, and there will always be an organization for every given system.

    In your comment to @Artem Barger‘s post you said:

    I’m only selecting on 5 of the 42 fields shared between these 2 tables

    Is it that there are other fields in the tables and/or query?

    Since you have a syntactic error, every comma may matter.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following two tables as a part of my order processing system:
I have two tables with the following columns: table1: id, agent_name, ticket_id, category, date_logged
I have the following two tables: Customer { int Id int Name } Bills
I have two tables in the system. I'm trying to make a VIEW that
I have the following two tables defined... CREATE TABLE [LogLevel] ( [Id] int primary
I have the following two columns: SELECT b.ip_address AS IP ,b.mask AS MASK FROM
Suppose I have the following two strings containing regular expressions. How do I coalesce
I have tried the following two statements: SELECT col FROM db.tbl WHERE col (LIKE
I have parsed XML using both of the following two methods... Parsing the XmlDocument
I have the following code that creates two objects (ProfileManager and EmployerManager) where the

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.