Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Tested on <code>5.0.77</code>:</p> <pre> 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 </pre> <p>Everything works fine.</p> <p>Note that <code>LEFT JOIN</code> is useless here, since you have a <code>FOREIGN KEY</code> to <code>organization</code>, and there will always be an <code>organization</code> for every given <code>system</code>.</p> <p>In your comment to <code>@Artem Barger</code>'s post you said:</p> <blockquote> <p>I'm only selecting on 5 of the 42 fields shared between these 2 tables</p> </blockquote> <p>Is it that there are other fields in the tables and/or query?</p> <p>Since you have a syntactic error, every comma may matter.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload