In article <[EMAIL PROTECTED]>,
Richard Broersma Jr <[EMAIL PROTECTED]> writes:

> I am curious, can you calculate something like this using only sql? Or you 
> you need to employee a
> procedural language like plpsgql?

You could use something like

  SELECT (SELECT count(*) FROM tbl t2 WHERE t2.id < t1.id), whatever
  FROM tbl t1

but correlated subqueries are slow; thus incrementing the counter in
the application would be faster for huge reports.


---------------------------(end of broadcast)---------------------------
TIP 6: explain analyze is your friend

Reply via email to