Re: [SQL] Counting Row

2005-07-24 Thread Pascual De Ruvo
I understand you need to count of tickets smaller than $recid given [CONDITION], in that case: $sql="select count(*) from [MYTABLE] where [CONDITION] and ticketnumber <=" . $recid  ; On 7/21/05, Ricky Sutanto <[EMAIL PROTECTED]> wrote:   Hi postgre people. Can anybody help to fix per

Re: [SQL] Counting Row

2005-07-24 Thread PFC
I'd suggest : - first getting the 'order fields' value for the ticket you want : SELECT field_order FROM mytable WHERE condition AND identifier=the_one_you're_looking_for ORDER BY field_order DESC LIMIT 1 - then counting all the tickets up to this order : SELECT count(*) FROM mytable WHERE

[SQL] Counting Row

2005-07-24 Thread Ricky Sutanto
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 wit

[SQL] Counting Row

2005-07-24 Thread Ricky Sutanto
  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