title: MySql error, trying to use INNER JOIN to select data from two tables
body: <p>I'm getting this error, when i try to select data from two tables in my database.</p>
  
  <blockquote>
    <p>#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'INNER JOIN hbr_galleri
        ON hbr_billede.GalleriID = hbr_galleri.GalleriID
        LIMIT ' at line 4 </p>
  </blockquote>
  
  <p>This is the query:</p>
  
  <p>(Sorry for the danish table/column names)</p>
  
  <pre><code>SELECT 
      `hbr_billede.BilledeID`, 
      `hbr_billede.GalleriID`, 
      `hbr_billede.FilePath`, 
      `hbr_billede.FilePathThumb`, 
      `hbr_billede.UploadetDato`, 
      `hbr_billede.UploadetAf`, 
      `hbr_billede.Fotograf`, 
      `hbr_billede.Caption`, 
      `hbr_billede.FeaturedFrontGallery`, 
      `hbr_billede.FeaturedWorldtour`, 
      `hbr_galleri.GalleriNavn`
  FROM `hbr_billede` 
  INNER JOIN `hbr_galleri`
  ON `hbr_billede.GalleriID` = `hbr_galleri.GalleriID`
  WHERE `hbr_billede.BilledeID` = 17 
  </code></pre>
  
  <p>I have tried multiple ways to make it work in phpMyAdmin, but with no luck. Can someone tell me what i'm doing wrong, or point me in the direction?</p>
  
  <p>My sql create scripts for these two tables, looks like this:</p>
  
  <pre><code>CREATE TABLE hbr_galleri
  (
      GalleriID int AUTO_INCREMENT NOT NULL,
      GalleriNavn varchar(255) NOT NULL,
      OprettetDato timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
      DatoEvent date NOT NULL,
      AntalBilleder int,
      FeaturedBillede int,
      OprettetAf int NOT NULL, /* BrugerID*/
      Offentligt boolean NOT NULL DEFAULT true,
      unikt_galleri varchar(255) DEFAULT NULL,
      PRIMARY KEY (GalleriID),
      UNIQUE KEY unikt_galleri (GalleriNavn,DatoEvent),
      FOREIGN KEY (OprettetAf) REFERENCES hbr_bruger(BrugerID) /*ON DELETE CASCADE*/
  );
  
  CREATE TABLE hbr_billede
  (
      BilledeID int AUTO_INCREMENT NOT NULL,
      GalleriID int NOT NULL,
      FilePath varchar(255) NOT NULL,
      FilePathThumb varchar(255) NOT NULL,
      UploadetDato timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
      UploadetAf int NOT NULL,
      Fotograf varchar(255) NOT NULL,
      Caption varchar(255),
      FeaturedFrontGallery boolean NOT NULL DEFAULT false,
      FeaturedWorldtour boolean NOT NULL DEFAULT false,
      PRIMARY KEY (BilledeID),
      FOREIGN KEY (GalleriID) REFERENCES hbr_galleri(GalleriID) ON DELETE CASCADE,
      UNIQUE (FilePath),
      UNIQUE (FilePathThumb)
  );
  </code></pre>