| From: | Madison Kelly <linux(at)alteeve(dot)com> |
|---|---|
| To: | Grzegorz Jaśkiewicz <gryzman(at)gmail(dot)com> |
| Cc: | pgsql-general(at)postgresql(dot)org |
| Subject: | Re: SELECT DISTINCT ... ORDER BY problem |
| Date: | 2008-12-09 21:16:22 |
| Message-ID: | 493EE026.5090501@alteeve.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-general |
Grzegorz Jaśkiewicz wrote:
> On Tue, Dec 9, 2008 at 9:02 AM, Grzegorz Jaśkiewicz <gryzman(at)gmail(dot)com> wrote:
>> or even, when you change bar to proper type - that is, timestamp
>>
>> SELECT distinct foo, min(bar) as minbar, max(bar) as maxbar FROM
>> table WHERE bar < '2008-12-07
>> 16:32:46' AND tbl_id=153 ORDER BY bar LIMIT 1;
>
> but than (after sec of thinking), you could just do
>
> SELECT foo, min(bar) AS minbar, max(bar) AS maxbar FROM table
> WHERE ..blabla.. GROUP BY foo ORDER BY maxbar LIMIT 1;
Woops, didn't see this. This actually solves a second problem I'd not
asked about, too. Thanks!!
Madi
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Bill Moran | 2008-12-09 22:06:25 | Re: equal and like |
| Previous Message | Madison Kelly | 2008-12-09 20:59:02 | Re: SELECT DISTINCT ... ORDER BY problem |