From: | Josh Berkus <josh(at)agliodbs(dot)com> |
---|---|
To: | Brian Ghidinelli <brian(at)pukkasoft(dot)com> |
Cc: | SF Postgres <sfpug(at)postgresql(dot)org> |
Subject: | Re: Counting unique comma-delimited values in a text field |
Date: | 2010-09-30 21:14:35 |
Message-ID: | 4CA4FDBB.1000808@agliodbs.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | sfpug |
Brian,
> SELECT count(theAnswer), theAnswer
> FROM (SELECT unnest(string_to_array(answer, ',')) AS theAnswer
> FROM Answers) AS theAnswer
> GROUP BY theAnswer
>
> This seems to work - any gotchas I might be overlooking or a better way
> of finding the totals?
Well, aside from normalizing the data, that's probably as good as it gets.
--
-- Josh Berkus
PostgreSQL Experts Inc.
http://www.pgexperts.com
From | Date | Subject | |
---|---|---|---|
Next Message | Brian Ghidinelli | 2010-09-30 21:17:03 | Re: Counting unique comma-delimited values in a text field |
Previous Message | David Fetter | 2010-09-29 18:18:11 | Re: Counting unique comma-delimited values in a text field |