Counting Row

From: "Ricky Sutanto" <ricky(at)connexiasolutions(dot)com>
To: <pgsql-sql(at)postgresql(dot)org>
Subject: Counting Row
Date: 2005-07-21 10:33:32
Message-ID: 20050721103304.2209252B23@svr1.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Hi postgre people. Can anybody help to fix performance of my query?

Let say, I have n number of queue ticket. (Which I use SELECT).

Is there faster method to know where is my ticket number in queue?

I use (while in PHP script ) and count one by one until my ticket number
match with row field .

$sql="select * from [MYTABLE] where [CONDITION] order by [FIELDORDER];

$rs=&$ctclink->Execute($sql);

$ctr=1;

$pos=0;

while (!$rs->EOF) {

if ($rs->fields[0]==$recid) {

$pos=$ctr;

break;

} else {

$ctr++;

$rs->MoveNext(); }

}

print $pos

is there any method to do that with simple??

Thanks,

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Erik Wasser 2005-07-21 13:57:56 Are long term never commited SELECT statements are a problem?
Previous Message Dongsoo Yoon 2005-07-21 09:29:29 Error when using array variable