Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Database & SysAdmin
  3. Database
  4. SQL query returning zero row in MySQL 5

SQL query returning zero row in MySQL 5

Scheduled Pinned Locked Moved Database
databasemysqlhtmlcomsysadmin
4 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • G Offline
    G Offline
    Guffa
    wrote on last edited by
    #1

    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 is int 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;

    A G 2 Replies Last reply
    0
    • G Guffa

      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 is int 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;

      A Offline
      A Offline
      Arun Immanuel
      wrote on last edited by
      #2

      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 than count or max

      Regards, Arun Kumar.A

      G 1 Reply Last reply
      0
      • A Arun Immanuel

        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 than count or max

        Regards, Arun Kumar.A

        G Offline
        G Offline
        Guffa
        wrote on last edited by
        #3

        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;

        1 Reply Last reply
        0
        • G Guffa

          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 is int 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;

          G Offline
          G Offline
          Guffa
          wrote on last edited by
          #4

          When I changed the driver used for the connection from version 2.50 to 3.51, it started working again. :)

          --- single minded; short sighted; long gone;

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups