R: [PHP-DB] need confirmation on a SELECT statement
| From: | Roberto Sartor | Date: | Fri, 08 Sep 2000 07:41:06 +0000 |
| Subject: | R: [PHP-DB] need confirmation on a SELECT statement | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-2733@lists.php.net to get a copy of this message | ||
SELECT p.id, p.name, p.price, b.sid, b.artno,
count(b.artno)
FROM products p, basket b
WHERE (p.id = b.artno) AND (b.sid = '$sid')
GROUP BY p.id, p.name, p.price, b.sid, b.artno
follows SQL standard language specifications.It's right!
Ciao
Roberto
> -----Messaggio originale-----
> Da: Arne Borkowski (borko.net) [mailto:arne@borko.net]
> Inviato: venerdì 8 settembre 2000 5.35
> A: PHP DB MailingList
> Oggetto: [PHP-DB] need confirmation on a SELECT statement
>
>
> 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.pht
> ml 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
>
>
> --
> 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
>