xyzii Posted March 5, 2017 Share Posted March 5, 2017 So I'm making an updates script with a database. It's finished but there's a flaw. The oldest updates come on top. I know I have to use table.sort (The meaning is not to sort the rows coming from the database but the table that is in the database row.) Link to comment
Mr.Loki Posted March 5, 2017 Share Posted March 5, 2017 searching the forum a bit wont hurt... Link to comment
xyzii Posted March 5, 2017 Author Share Posted March 5, 2017 Hey, can you read? "(The meaning is not to sort the rows coming from the database but the table that is in the database row.) " Link to comment
Mr.Loki Posted March 5, 2017 Share Posted March 5, 2017 Oh then my bad. Sorting the database seems alot more troublesome than just sorting the data when you call it. Link to comment
Moderators Citizen Posted March 6, 2017 Moderators Share Posted March 6, 2017 On 05/03/2017 at 06:08, xyzii said: The meaning is not to sort the rows coming from the database but the table that is in the database row. What do you mean by that ? Can you give us a sample of what you get and an example of what you want to get ? Link to comment
xyzii Posted March 6, 2017 Author Share Posted March 6, 2017 There is a column in the updates database, the column has a day, month, year number. Second column has a table of the updates. I want to sort the table of the updates, not how the database is sorted. I want that '- Added /updates' to be on the bottom when '- Added locking' should be on the top since that was newly added. Link to comment
pa3ck Posted March 6, 2017 Share Posted March 6, 2017 Why don't you use ORDER BY Desc / Asc ? 1 Link to comment
Mr.Loki Posted March 6, 2017 Share Posted March 6, 2017 1 hour ago, pa3ck said: Why don't you use ORDER BY Desc / Asc ? That's that I'm trying to understand also. Link to comment
xyzii Posted March 7, 2017 Author Share Posted March 7, 2017 (edited) Because it only sorts the dates in the right order, not the table that is inside a different column, I NEED TO SORT THE TABLE IN THAT COLUMN or am I understanding something wrong about ORDER BY ASC/DESC? Edited March 7, 2017 by xyzii 1 Link to comment
ShayF2 Posted March 7, 2017 Share Posted March 7, 2017 (edited) Use a local lua table first. Gather the data and store it in the table. data = {} for i,v in pairs(data) do i = i*-1 -- then send the data linked to the index from the table to the database. -- this will comepletely reverse your table, maybe what you are looking for. end This should reverse the tables index. Edited March 7, 2017 by shay103 Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now