On Thu, 9 Jan 2003 22:59:03 +0800 (CST), [EMAIL PROTECTED] (Gary fung)
wrote:

> My coding is similar as:
> 
>  $value2 = $dbh->prepare("SELECT page FROM $Table 
> 
> GROUP BY page") || die "Couldn't add record, ".$dbh->errstr();
> 
> Whenever I use "GROUP BY.." , an error statement will go out :
> 
> "SQL ERROR: Can't find table names in FROM clause!"

Others have pointed out the possibility that $Table may be empty. I'd
like to add that I think there's another error -- as far as I know,
GROUP BY can only be used when you have aggregate functions such as SUM,
MAX, COUNT(...) etc. (For example, "SELECT custno, count(ordernum) FROM
orders GROUP BY custno ORDER BY 2 DESC" to select the customers together
with the number of orders, grouped by customer but sorted by number of
orders.)

Did you mean ORDER BY, perhaps?

Cheers,
Philip

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to