I want to use the PyQt
equivalent of the following SQL
statement in my model/view-based PyQt
application:
SELECT * FROM table ORDER BY foo, bar
How do I sort by multiple columns in a QSqlTableModel
, especially since setSort()
accepts a single column
argument?
It seems there's an alternative to
setSort()
, calledsetFilter()
. From the PyQt docs:Ergo, this solves the problem:
where the
never_zero
field is (surprise, surprise) never zero.