Gossamer Forum
Home : General : Databases and SQL :

got problem in making a correct query statement

Quote Reply
got problem in making a correct query statement
i got problem in making a correct query statement. how could get helpf from the forum.



city name

city1 a
city1 b
city1 c
city1 d
city2 e
city2 f

SELECT count(*), city, name FROM $table_order WHERE (MONTH(orderdate) = MONTH(now())) group by city );

while (my $rec = $sth->fetchrow_arrayref())
{ print "$rec->[0] : $rec->[1] :$rec->[2]\n"; }

the result will be

4 : city1: a
1 : city2: e

how to make the query result be:

4 : city1: d
1 : city2: f





Thanks in advance.
Quote Reply
Re: [courierb] got problem in making a correct query statement In reply to
any one could help me? thanks
Quote Reply
Re: [courierb] got problem in making a correct query statement In reply to
I finally got the alternative solutionCool
Quote Reply
Re: [courierb] got problem in making a correct query statement In reply to
It would help other users who have similar issues, if you post the solution you found.
========================================
Buh Bye!

Cheers,
Me