Reply to Re: [PHP] while loop

Your name:

Reply:


Posted by Marek Kilimajer on 02/23/05 21:59

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@gmail.com]
> 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

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация