josue <josue@xxxxxxxxxxxx> writes: > to something like: > > select counter(),a,b from foo; The OLAP SQL Standard way to spell this is "ROW_NUMBER() OVER ()". Postgres doesn't have any support for any of the OLAP features however. It would be really nice because they're nigh impossible to emulate with standard SQL. You might be able to get away with a sequence, but if you have multiple connections running this query at the same time then that will be awkward. You would have to create a new sequence for the query every time. If you can you're probably best off doing this in the client. You can do any sort of level break logic you need in the client, and even refer to previous records. The only thing that would make doing it in the client awkward would be if you were planning to use the results in more query logic such as a join. -- greg ---------------------------(end of broadcast)--------------------------- TIP 5: Have you checked our extensive FAQ? http://www.postgresql.org/docs/faq