Re: while loop

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Reinhart Viane wrote:
Well I'm able to do that, there are only 4 different types, but the 4
queries have exactly the same syntax so I think it's better to combine them.
Not?

Since mysql 4.1 you can use GROUP_CONCAT() function:

SELECT Act_date, Act_type_id,
LEFT( GROUP_CONCAT(Act_name
                   ORDER BY Act_date
                   SEPARATOR '|'),
      129 ) as Act_names
FROM activities GROUP BY Act_date, Act_type_id;

Act_names will be string containing the names separated by |
129 is the maximum size of Act_name * 2 + 1 for the separator.


-----Oorspronkelijk bericht-----
Van: Justin Lilly [mailto:justinlilly@xxxxxxxxx] Verzonden: woensdag 23 februari 2005 18:57
Aan: php-general@xxxxxxxxxxxxx
Onderwerp: Re: while loop


Perhaps it is just me, but wouldn't it be easier to make individual
mysql queries for each different act type? That would make the sorting
-much- easier. I'm not sure if that's an option, but if it is, I'd
consider exploring it.

select * from activities where act_date >= NOW() && act_type_id = 1

or something of that nature.

-justin

-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux