On Mon, Sep 29, 2003 at 17:27:47 +0300,
  Timo <[EMAIL PROTECTED]> 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 |       271
 935 |        1 |       276
 924 |        1 |       581
 902 |        2 |       271
 902 |        3 |       271
 972 |        2 |       275
 935 |        2 |       276
 924 |        2 |       581
 924 |        3 |       581
(9 rows)

---------------------------(end of broadcast)---------------------------
TIP 7: don't forget to increase your free space map settings

Reply via email to