On Mon, Sep 29, 2003 at 17:27:47 +0300, Timo <siroco@suomi24.fi> wrote:
>
> I'd need to get a result set where rows are sorted according to these rules:
>
> 1. first all rows with priority = 1 sorted according to seniority
> 2. then the rest of the rows sorted by seniority, priority
You can do something like:
bruno=> select * from foo order by priority <> 1, seniority, priority;id | priority | seniority
-----+----------+-----------902 | 1 | 271935 | 1 | 276924 | 1 | 581902 |
2| 271902 | 3 | 271972 | 2 | 275935 | 2 | 276924 | 2 | 581924
| 3 | 581
(9 rows)