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