Forum > Databases

[SOLVED] Record sorting SQLite

(1/1)

Pe3s:
Hello, is it possible to sort records in such a way that the database remembers the sorting?

--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---procedure TForm1.SpeedButton5Click(Sender: TObject);begin   ZQuery1.SQL.Text := 'SELECT * FROM users ORDER BY Name ASC';   ZQuery1.ExecSQL;   ZQuery1.Open;end; 

BSaidus:
Short answer: NO

--- Quote from: Pe3s on November 18, 2023, 05:18:04 pm ---Hello, is it possible to sort records in such a way that the database remembers the sorting?

--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---procedure TForm1.SpeedButton5Click(Sender: TObject);begin   ZQuery1.SQL.Text := 'SELECT * FROM users ORDER BY Name ASC';   // Use ExecSQL if you need to Insert, Update, Delete a record ( in this case you do not need it )   // ZQuery1.ExecSQL;   ZQuery1.Open;end; 


--- End quote ---

Pe3s:
Is there no way to do it in alphabetical order?

dsiders:

--- Quote from: Pe3s on November 19, 2023, 07:19:38 pm ---Is there no way to do it in alphabetical order?

--- End quote ---

'order by NAME asc' is alphabetic order. IF you want case-insensitive alphabetic order use the 'COLLATE NOCASE clause.


--- Code: MySQL  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---SELECT * FROM users ORDER BY Name COLLATE NOCASE ASC
You can apply collate to the schema too.

Pe3s:
Thank you :)

Navigation

[0] Message Index

Go to full version