开发者

Order by difference between 2 columns of

开发者 https://www.devze.com 2023-02-25 12:27 出处:网络
I have a mysql query to oreder by using difference of two fields of same table SELECT * FROM postings ORDER BY vote_up - vote_down;

I have a mysql query to oreder by using difference of two fields of same table

SELECT *
FROM postings
ORDER BY vote_up - vote_down;

its working

How i write this query using propel criteria,

I write like this $crite开发者_StackOverflow中文版ria->addDescendingOrderByColumn(self::VOTE_UP-self::VOTE_DOWN)

but it makes errors. Anybody know please help.

Help is highly appreciated.

Thanks,


Try:

$criteria->addDescendingOrderByColumn(self::VOTE_UP.' - '.self::VOTE_DOWN)

0

精彩评论

暂无评论...
验证码 换一张
取 消