Re: More wacky grouping
От
Josh Berkus
Тема
Re: More wacky grouping
Дата
Msg-id
200304031642.16094.josh@agliodbs.com
Ответ на
More wacky grouping (James Taylor)
Список
Дерево обсуждения
More wacky grouping "James Taylor" <jtx@hatesville.com>
Re: More wacky grouping Josh Berkus <josh@agliodbs.com>
Re: More wacky grouping Joe Conway <mail@joeconway.com>
Re: More wacky grouping Manfred Koizar <mkoi-pg@aon.at>
James, > I need to do grouping based on various aggregates, but the way my table > is set up (it can't change) is making things kind of difficult. Yeah. You should track down the previous database designer and break his fingers .... Anyway, you'll need to work through subselects. That is, subselect each datatype from the table as if it were a seperate table and join them, e.g. FROM (SELECT content, id_customer FROM table1 WHERE id_datatype = 2) tb2,(SELECT content, id_customer FROM table1 WHERE id_datatype = 3) tb3 etc. Also, since you'll be summing on a text field which is being converted to NUMERIC on the fly, expect your query to be slow as molasses. -- -Josh BerkusAglio Database SolutionsSan Francisco
В списке pgsql-sql по дате отправления