I
I
Ilnur2018-01-27 21:48:42
SQL
Ilnur, 2018-01-27 21:48:42

How to sort by match (QSqlTableModel )?

Hello everyone)
I am using QSqlTableModel.
The QtableView should first show the entries for author = 'user' and below all the other entries.
Tried model->setFilter(QString(AUTHOR" like 'user' ")); but the rest of the records are not displayed (which is obvious).
ps: If you write model->setFilter(QString(AUTHOR" like 'user%' ")); More records are displayed for user2
So far, nothing more has come up.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
L
Lazy @BojackHorseman, 2018-01-27
@Il_noor

as always, you need to dance from the final sql query
, you should end up with something like this
I write in a muscular dialect close to my heart, in standard t-sql it will be a bit different

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question