Author Topic: strange GROUP_CONCAT problem  (Read 665 times)

0 Members and 1 Guest are viewing this topic.

Offline mabogTopic starter

  • Irregular
  • Posts: 38
    • View Profile
strange GROUP_CONCAT problem
« on: March 10, 2010, 01:52:02 AM »
When adding GROUP_CONCAT to the query, row count is:
Showing rows 0 - 0 (1 total, Query took 0.0224 sec)
Without GROUP_CONCAT:
Showing rows 0 - 4 (5 total, Query took 0.0215 sec)

So in the first case mysql_num_rows() doesn't work anymore EVEN query result (via PHPMySQL) is OK!

Why row count is zero??

Offline mabogTopic starter

  • Irregular
  • Posts: 38
    • View Profile
Re: strange GROUP_CONCAT problem
« Reply #1 on: March 11, 2010, 07:07:59 AM »
It's PHPMyAdmin, not PHPMySQL  :-\

Still need help with this "showing rows 0-0"  :'(

Offline fenway

  • MySQL Si-Fu / PHP Resident Alien
  • Global Moderator
  • 'Mind Boggling!'
  • *
  • Posts: 15,444
  • Gender: Male
    • View Profile
Re: strange GROUP_CONCAT problem
« Reply #2 on: March 15, 2010, 12:58:56 PM »
Really? You asked mysql to group everything into a single record -- and it did -- so why are you blaming a function?
:anim_rules: Seriously... if people don't start reading this before posting, I'm going to consider not answering at all.

Offline mabogTopic starter

  • Irregular
  • Posts: 38
    • View Profile
Re: strange GROUP_CONCAT problem
« Reply #3 on: March 16, 2010, 07:10:43 AM »
Really? You asked mysql to group everything into a single record -- and it did -- so why are you blaming a function?

It's not a single record, it's 5 rows, in both cases. But with GROUP_CONCAT row count is zero even rows are visible!
Anyway I solved this with second query and with simple php comparison.

Offline fenway

  • MySQL Si-Fu / PHP Resident Alien
  • Global Moderator
  • 'Mind Boggling!'
  • *
  • Posts: 15,444
  • Gender: Male
    • View Profile
Re: strange GROUP_CONCAT problem
« Reply #4 on: March 16, 2010, 07:48:53 AM »
There is no possible way that with and without group-concat you get the same number of rows.
:anim_rules: Seriously... if people don't start reading this before posting, I'm going to consider not answering at all.

Offline mabogTopic starter

  • Irregular
  • Posts: 38
    • View Profile
Re: strange GROUP_CONCAT problem
« Reply #5 on: March 16, 2010, 10:48:31 AM »
There is no possible way that with and without group-concat you get the same number of rows.

OK. Can't remember anymore was there 3 or 4 or 5 rows but at least there was few. But still 'showing rows 0-0' ...

Offline fenway

  • MySQL Si-Fu / PHP Resident Alien
  • Global Moderator
  • 'Mind Boggling!'
  • *
  • Posts: 15,444
  • Gender: Male
    • View Profile
Re: strange GROUP_CONCAT problem
« Reply #6 on: March 18, 2010, 01:29:29 AM »
But still "1 total".
:anim_rules: Seriously... if people don't start reading this before posting, I'm going to consider not answering at all.

Offline mabogTopic starter

  • Irregular
  • Posts: 38
    • View Profile
Re: strange GROUP_CONCAT problem
« Reply #7 on: March 18, 2010, 02:35:36 AM »
But still "1 total".

Which is incorrect because there was more than 1 row.

But I tested that query again, with / without group_concat:
Without: Showing rows 0 - 7 (8 total, Query took 0.0218 sec), 8 rows visible
With: Showing rows 0 - 0 (1 total, Query took 0.0220 sec), 8 rows visible

??

Offline fenway

  • MySQL Si-Fu / PHP Resident Alien
  • Global Moderator
  • 'Mind Boggling!'
  • *
  • Posts: 15,444
  • Gender: Male
    • View Profile
Re: strange GROUP_CONCAT problem
« Reply #8 on: March 20, 2010, 06:05:13 PM »
Show both result sets.
:anim_rules: Seriously... if people don't start reading this before posting, I'm going to consider not answering at all.