Re: SELECT fails??? (fwd)

From: Date: Thu, 07 Sep 2000 01:44:45 +0000
Subject: Re: SELECT fails??? (fwd)
Groups: php.general 
Request: Send a blank email to php-general+get-15630@lists.php.net to get a copy of this message
On Wed, 6 Sep 2000, Arne Borkowski (borko.net) wrote: <snip> > $sql = "SELECT p.id, p.name, p.price, b.sid, 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 leave out the GROUP BY clause, it doesat least it return data (in a way > I don't want it) :-( I'm not sure about Interbase, but I think that the variables in the GROUP BY clause must be returned in the SELECT variable list. You don't have b.artno in the SELECT variable list. You have count(b.artno). Perhaps what you want would be something like: GROUP BY p.id , 5 The "5" would group on the value of "count(b.artno)" John

« previous php.general (#15630) next »