On Sun, 1999-10-03 23:49:51 +0800, Chas Sweeting wrote:
> Now listing events with 'SELECT * FROM eventdates' will
> make the event appear twice which is not what we want.
> Up until now, I've been parsing the results with python to
> prevent double listing.
>
> It would be really handy if there were some SQL which could
> return a list of dates directly, using a GROUP BY event ID.
> eg. event 10003 would be returned as
>
> event ID startdates enddates
> -------- ---------- --------
> 10003 1999-10-04, 1999-10-09 1999-10-09, 1999-10-11
>
> Or perhaps even :
>
> event ID dates
> -------- -----
> 10003 1999-10-04 - 1999-10-09, 1999-10-09 - 1999-10-11
>
> I thought that CONCAT and GROUP BY would achieve the latter result
> but had no joy (using SELECT eventID, concat(startdates) FROM
> eventdates GROUP BY eventID)
>
> Is it possible to return a list using GROUP BY ? Is this the right
> way to do this or am I just barking up the wrong tree ?
I also thought about similiar problems, with the same result:
We would need something like a new aggregation function
GRPCONCAT(field, 'delimiter') that does for strings what
SUM() does for numbers.
But for the time being you'll have to stick to the Python code ...
Regards,
Martin
--
Martin Ramsch <m.ramsch@stripped> <URL: http://home.pages.de/~ramsch/ >
PGP KeyID=0xE8EF4F75 FiPr=5244 5EF3 B0B1 3826 E4EC 8058 7B31 3AD7