SQL query returning zero row in MySQL 5
-
My web hotel has upgraded from MySQL 4.1.21 to MySQL 5.0.37. The only problem I have had with this is that a query doesn't return anything in the result any more:
select sum(i.FileSize) as TotalSize from Photos p inner join Images i on i.PhotoId=p.PhotoId and i.IsPublic=1 where p.IsPublicArt=1 or p.IsPublicCommon=1
If I change "sum" to "max" or "count" the query return one row, with "sum" or "avg" it returns zero rows. FileSize isint
and can not be null. If I test the query directly in the database (using phpmyadmin) it returns one row with all the aggregates. My connection string looks like this (with a different uid and pwd of course):"driver={MySQL};server=mysql.loopia.se;uid=asdfasdf;pwd=asdfasdf;database=voidstation_com"
I have tried to add";option=3"
to the connection string, but that didn't make any difference. The list of changes that the web hotel linked to: http://dev.mysql.com/doc/refman/5.0/en/upgrading-from-4-1.html[^] I don't see anything there that should affect this. Anybody got any ideas?--- single minded; short sighted; long gone;
-
My web hotel has upgraded from MySQL 4.1.21 to MySQL 5.0.37. The only problem I have had with this is that a query doesn't return anything in the result any more:
select sum(i.FileSize) as TotalSize from Photos p inner join Images i on i.PhotoId=p.PhotoId and i.IsPublic=1 where p.IsPublicArt=1 or p.IsPublicCommon=1
If I change "sum" to "max" or "count" the query return one row, with "sum" or "avg" it returns zero rows. FileSize isint
and can not be null. If I test the query directly in the database (using phpmyadmin) it returns one row with all the aggregates. My connection string looks like this (with a different uid and pwd of course):"driver={MySQL};server=mysql.loopia.se;uid=asdfasdf;pwd=asdfasdf;database=voidstation_com"
I have tried to add";option=3"
to the connection string, but that didn't make any difference. The list of changes that the web hotel linked to: http://dev.mysql.com/doc/refman/5.0/en/upgrading-from-4-1.html[^] I don't see anything there that should affect this. Anybody got any ideas?--- single minded; short sighted; long gone;
Guffa wrote:
If I change "sum" to "max" or "count" the query return one row, with "sum" or "avg" it returns zero rows.
I do not know about MySql. But see what you can do with this hint:
sum
will return a large value thancount
ormax
Regards, Arun Kumar.A
-
Guffa wrote:
If I change "sum" to "max" or "count" the query return one row, with "sum" or "avg" it returns zero rows.
I do not know about MySql. But see what you can do with this hint:
sum
will return a large value thancount
ormax
Regards, Arun Kumar.A
Thanks for your reply. When I use sum and run the query in phpmyadmin, the exact value that it returns is 609538140. It's larger than what count and max returns, but it's still way within the bounds of an int. Anyway, it's not a problem with reading the value from the row, as the query doesn't even return a row. The result is empty. It doesn't contain any row to read from.
--- single minded; short sighted; long gone;
-
My web hotel has upgraded from MySQL 4.1.21 to MySQL 5.0.37. The only problem I have had with this is that a query doesn't return anything in the result any more:
select sum(i.FileSize) as TotalSize from Photos p inner join Images i on i.PhotoId=p.PhotoId and i.IsPublic=1 where p.IsPublicArt=1 or p.IsPublicCommon=1
If I change "sum" to "max" or "count" the query return one row, with "sum" or "avg" it returns zero rows. FileSize isint
and can not be null. If I test the query directly in the database (using phpmyadmin) it returns one row with all the aggregates. My connection string looks like this (with a different uid and pwd of course):"driver={MySQL};server=mysql.loopia.se;uid=asdfasdf;pwd=asdfasdf;database=voidstation_com"
I have tried to add";option=3"
to the connection string, but that didn't make any difference. The list of changes that the web hotel linked to: http://dev.mysql.com/doc/refman/5.0/en/upgrading-from-4-1.html[^] I don't see anything there that should affect this. Anybody got any ideas?--- single minded; short sighted; long gone;