Results 1 to 3 of 3
  1. #1
    Join Date
    Dec 2003
    Posts
    2

    Red face Unanswered: Troubles with the Versions

    Hello,

    I have big Problem. I build a Database driven WebSite but tested and developed my Code with MySQL 4.0.x. But on my Server i have MySQL 3.23.49 because it is last stable release for Debian. My support told me that, i hope that it is true.
    And i think some SQL features from 4.0.x are not included in the 3.23.49version. I think Subquerys and Joins (just a guess, please correct me) aren't support. But i have no idee how to write the SQL query without that.
    Could somebody help me?
    I post the Query in SQL, the Error Message and the tables.

    SQL Statement:

    SELECT Ausstellung.titel,Ausstellung.gbeschreib,Kuenstler .bezeichnung,concat(date_format(start,'%d.%m'),' - ',date_format(ende,'%d.%m.%y')) as datum, Ausstellung.start, Kuenstler.KID, Kuenstler.Name Name, Kuenstler.Vorname Vorname, erarbeitet.AID AID FROM Kuenstler RIGHT JOIN (Ausstellung LEFT JOIN erarbeitet ON Ausstellung.AID = erarbeitet.AID) ON Kuenstler.KID = erarbeitet.KID WHERE (date_format(Ausstellung.start,'%y')= '01') order by Ausstellung.AID

    ERROR:

    You have an error in your SQL syntax near '(Ausstellung LEFT JOIN erarbeitet ON Ausstellung.AID = erarbeitet.AID) ON Kuenst' at line 1

    Tables:

    CREATE TABLE `kuenstler` (
    `KID` bigint(20) NOT NULL auto_increment,
    `Name` varchar(255) default NULL,
    `Vorname` varchar(255) default NULL,
    `bezeichnung` text NOT NULL,
    PRIMARY KEY (`KID`,`KID`)
    ) TYPE=MyISAM AUTO_INCREMENT=28 ;
    _______

    CREATE TABLE `ausstellung` (
    `AID` int(11) NOT NULL auto_increment,
    `Start` date default NULL,
    `Ende` date default NULL,
    `gBeschreib` varchar(255) default NULL,
    `Titel` varchar(255) default NULL,
    `Bild1` varchar(255) default NULL,
    `Bild2` varchar(255) default NULL,
    `Bild3` varchar(255) default NULL,
    `Bild4` varchar(255) default NULL,
    PRIMARY KEY (`AID`)
    ) TYPE=MyISAM AUTO_INCREMENT=21 ;

    _______

    CREATE TABLE `kuenstler` (
    `KID` bigint(20) NOT NULL auto_increment,
    `Name` varchar(255) default NULL,
    `Vorname` varchar(255) default NULL,
    `bezeichnung` text NOT NULL,
    PRIMARY KEY (`KID`,`KID`)
    ) TYPE=MyISAM AUTO_INCREMENT=28 ;

    Please if u think that it isn't possible to do the same Statement in MySQL 3.23.49, teel me this.


    Thank u that u read it and if u have any comments or solutions, please tell me these.

    Regards
    Fabio

  2. #2
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    instead of this --
    Code:
      FROM Kuenstler 
    RIGHT
      JOIN (
           Ausstellung
    LEFT
      JOIN erarbeitet 
        ON Ausstellung.AID = erarbeitet.AID
           ) 
        ON Kuenstler.KID = erarbeitet.KID
    try this --
    Code:
      FROM Ausstellung
    LEFT
      JOIN erarbeitet 
        ON Ausstellung.AID = erarbeitet.AID
    LEFT
      JOIN Kuenstler
        ON erarbeitet.KID  = Kuenstler.KID
    also, if you really want to ORDER BY Ausstellung.AID then you should probably include it in the SELECT list

    rudy
    http://r937.com/

    (der lederhosen guy)

  3. #3
    Join Date
    Dec 2003
    Posts
    2

    Great, it works!!

    Thanks r937,

    Thanks for fast reply.
    Thanks for solution.

    Have a great day and merry christmas.

    Regards
    Fabio

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •