Re: using distinct in a single column to get multiple rows
From: Lennart Jonsson <erik.lennart.jonsson_at_gmail.com>
Date: Wed, 21 Sep 2011 23:11:56 +0200
Message-ID: <j5djus$jqo$1_at_dont-email.me>
On 2011-09-21 19:28, Robert Klemme wrote: [...]
> In that case I'd prefer this as it is so much simpler:
>
> select userid, title, min(zipcode) as zip_min
> from myTable
> group by userid, title
>
Date: Wed, 21 Sep 2011 23:11:56 +0200
Message-ID: <j5djus$jqo$1_at_dont-email.me>
On 2011-09-21 19:28, Robert Klemme wrote: [...]
> In that case I'd prefer this as it is so much simpler:
>
> select userid, title, min(zipcode) as zip_min
> from myTable
> group by userid, title
>
If a user can have several titles it won't work, but that can of course be solved by adding an aggregate functions on title.
/Lennart Received on Wed Sep 21 2011 - 16:11:56 CDT