Create complex query on Propel

64 Views Asked by At

I have a table with columns(id, name, title, time), I want to get a query that gives each row a virtual number by counting row with time condition!
My sql Select is this:

SELECT 
    aTbl.name, 
    aTbl.title, 
    (
        SELECT COUNT(*) 
        FROM tbl AS tmpTbl 
        WHERE tmpTbl.time > aTbl.time
    ) AS serviceNumber
FROM tbl AS aTbl 
ORDER BY serviceNumber  

How can I get query like this with propel query class ?
If this can't happen, what alternative way would you suggest for doing it?

thanks ;-)

0

There are 0 best solutions below