RE: [PHP-DB] need confirmation on a SELECT statement

From: Date: Sat, 09 Sep 2000 12:01:32 +0000
Subject: RE: [PHP-DB] need confirmation on a SELECT statement
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-2765@lists.php.net to get a copy of this message
so ... thinking for a second I dare to say that mysql is not behaving the way the standards "demand" it? Is that the case? MySql does not follow the standards? I mean in some cases? Cheers, Arne > -----Original Message----- > From: Meir kriheli [mailto:mksoft@netvision.net.il] > Sent: Friday, September 08, 2000 11:03 AM > To: Arne Borkowski (borko.net); PHP DB MailingList > Subject: Re: [PHP-DB] need confirmation on a SELECT statement > > > Hi Arne. > > I'm no expert but I think the sql syntax says you should group by all the > non-calculated fields. > > So the statment > > $sql .= "GROUP BY p.id, p.name, p.price, b.sid, b.artno " > > is correct one according to the standarts. > > -- > Meir Kriheli > MKsoft computer systems > > "There's someone in my head but it's not me" - Pink Floyd > > > when I run the following SELECT statement on mysql > > everything's fine ... it fails, however, in InterBase > > telling me > > > > Warning: InterBase: Dynamic SQL Error SQL error > > code = -104 invalid column reference in > > > /usr/local/apache/htdocs/projects/demoshopibase/showbasket.phtml > on line 25 > > > > > > The statement goes here: > > > > $sql = "SELECT p.id, p.name, p.price, b.sid, b.artno, > count(b.artno) " > > $sql .= "FROM products p, basket b " > > $sql .= "WHERE (p.id = b.artno) AND (b.sid = '$sid') " > > $sql .= "GROUP BY p.id, b.artno " > > > > > > If I want to run it with InterBase, I need to add ALL columns > to the GROUP > > BY > > clause. Although I am not SQL guru, that seems strange to me. > > > > This form works and need somebody to tell me if this is my lach > of SQL or a > > specialty > > in PHP / InterBase interconnection ... (I couldn't believe that > either, to > > be honest) > > > > > > $sql = "SELECT p.id, p.name, p.price, b.sid, b.artno, > count(b.artno) " > > $sql .= "FROM products p, basket b " > > $sql .= "WHERE (p.id = b.artno) AND (b.sid = '$sid') " > > $sql .= "GROUP BY p.id, p.name, p.price, b.sid, b.artno " > > > > > > Does anyone have a clue or can at least direct me to find the > clue myself? > > Arne > > > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-db-unsubscribe@lists.php.net > For additional commands, e-mail: php-db-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net >

« previous php.db (#2765) next »