From: Boyan Nedkov [EMAIL PROTECTED]
Putting more than one table in the FROM clause means tables are joined,
then at least following problems could arise:
- using WHERE clause you can have empty recordset returned and then
COUNT conflicts with it because there is actually no any data to be
I cannot seem to get a SELECT COUNT for a query from fields in two different tables
and a WHERE clause. Does anyone know if this is not possible with php/mysql or am I
doing something wrong? I have tried a number of variations on the following code:
$sql = SELECT COUNT(*), bandid, bandname,
Mark Gordon wrote:
I cannot seem to get a SELECT COUNT for a query from fields in two different tables and a WHERE clause. Does anyone know if this is not possible with php/mysql or am I doing something wrong? I have tried a number of variations on the following code:
$sql = SELECT COUNT(*),
Yes, query is definitely working without COUNT(*). Even in the most stripped down
form, the query fails:
$sql = SELECT COUNT(bandid), genre
FROM bands, genre;
$result=mysql_query($sql);
while ($gen=mysql_fetch_row($result)) {
echo $gen[1];
}
John W. Holmes [EMAIL PROTECTED] wrote:
Mark Gordon
Mark Gordon wrote:
Yes, query is definitely working without COUNT(*). Even in the most stripped down form, the query fails:
$sql = SELECT COUNT(bandid), genre
FROM bands, genre;
$result=mysql_query($sql);
while ($gen=mysql_fetch_row($result)) {
echo $gen[1];
}
Fails how? If it echos zero, it's
Putting more than one table in the FROM clause means tables are joined,
then at least following problems could arise:
- using WHERE clause you can have empty recordset returned and then
COUNT conflicts with it because there is actually no any data to be
returned;
- joining two (or more)