SQLAlchemy的group_by和order_by的區別


1、官網解釋:
group_by (*criterion)

apply one or more GROUP BY criterion to the query and return the newly resulting Query

2、官網解釋:

order_by(*criterion)

apply one or more ORDER BY criterion to the query and return the newly resulting Query

All existing ORDER BY settings can be suppressed by passing None - this will suppress any ORDER BY configured on mappers as well.

Alternatively, an existing ORDER BY setting on the Query object can be entirely cancelled by passing False as the value - use this before calling methods where an ORDER BY is invalid.

參考:

1、http://docs.sqlalchemy.org/en/rel_0_9/orm/query.html

2、http://www.w3school.com.cn/sql/sql_groupby.asp


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM