c++ - Unconventional sorting of table elements using SQL in Qt -
I am creating a ticket system and I want to create a table for people to see all open tickets. I want them to be priority - important - & gt; High - & gt; Medium - & gt; Less.
While (currentRow & lt; rows) I did before a test database program, which I did earlier, which ordered entries in a table. {Qry.prepare ("Select Last Name From Username: F1, F2"); Qry.bindValue (": F1", currentro); Qry.bindValue (": f2", present-day + 1); qry.exec (); qry.next (); CurrentCol = 0; // This loop will populate all the columns in the current row (current call & lt; ui- & gt; table- & gt; column;) ()) {QTableWidgetItem * setdes = new QTableWidgetItem; setdes-> setText (qry.value (currentCol) .toString ()); UI- & gt; Table-> Set item (calculation, current call-1, setdes); currentCol ++; } CurrentRow ++; } Obviously I can not change the query of last name with priority because it sorted alphabetically instead of sequence I would like to sort them out. Is there any way that I can execute an SQL query to sort them in the order given above, or am I going to populate the table and then sort myself?
You can use a case when ... then your Construction for mapping the string on numeric values, such as priority = 'important' then 1 priority = 'high' occurs when priority = 'medium' occurs when 3 priority = 'less' then 4 seconds 5 END
Comments
Post a Comment