| From: | "Ansley, Michael" <Michael(dot)Ansley(at)intec(dot)co(dot)za> | 
|---|---|
| To: | "Ansley, Michael" <Michael(dot)Ansley(at)intec(dot)co(dot)za>, "'Michael Richards'" <miker(at)scifair(dot)acadiau(dot)ca> | 
| Cc: | pgsql-sql(at)postgreSQL(dot)org, hackers(at)postgreSQL(dot)org, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> | 
| Subject: | RE: [HACKERS] Counting bool flags in a complex query | 
| Date: | 1999-07-16 10:01:26 | 
| Message-ID: | 1BF7C7482189D211B03F00805F8527F70ED04A@S-NATH-EXCH2 | 
| Views: | Whole Thread | Raw Message | Download mbox | Resend email | 
| Thread: | |
| Lists: | pgsql-hackers pgsql-sql | 
Sorry guys, this line:
>> ORDER BY (if(folderid < 0) then return(abs(folderid)) else
>> return(folderid+max(abs(MIN(folderid)))))
Should have read:
ORDER BY (if(folderid < 0) then return(abs(folderid)) else
return(folderid+abs(MIN(folderid))))
The max was an error.
MikeA
>> 
>> Why don't you adjust the ids of your system folders, such 
>> that they are
>> ordered properly?  You should have a fixed number of system 
>> folders, so you
>> can guarantee the ids that they will receive.  So make the 
>> Inbox -4.  Then
>> you just order by folder id, ascending.  -4 comes first, 
>> with the user
>> folders always coming after the system folders.
>> 
>> Alternatively, you can sort by an expression, something like:
>> 
>> ORDER BY (if(folderid < 0) then return(abs(folderid)) else
>> return(folderid+max(abs(MIN(folderid)))))
>> 
>> What this does is shift all the ids up to ensure that they 
>> all fall into the
>> positive range, while inverting the order of the negative 
>> ids, which seems
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Tom Lane | 1999-07-16 13:25:56 | Re: [HACKERS] final #include cleanup | 
| Previous Message | Ansley, Michael | 1999-07-16 09:18:40 | RE: [HACKERS] Counting bool flags in a complex query | 
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Ademir Mazer Jr | 1999-07-16 13:13:13 | Stored Procedures and other stuffs | 
| Previous Message | Ansley, Michael | 1999-07-16 09:18:40 | RE: [HACKERS] Counting bool flags in a complex query |