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:[EMAIL PROTECTED] Verzonden: woensdag 23 februari 2005 18:57
Aan: php-general@lists.php.net
Onderwerp: Re: [PHP] 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



Reply via email to