need confirmation on a SELECT statement
| From: | borko.net) | Date: | Fri, 08 Sep 2000 03:35:20 +0000 |
| Subject: | need confirmation on a SELECT statement | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-2729@lists.php.net to get a copy of this message | ||
Hi everybody,
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?
TIA and Cheers,
Arne