I am developing an iOS App that is bank passbook type. I have a problem when I insert a record in the database, it should be arranged in chronological order according to date as below.
Suppose I withdraw from ATM $20 and date is 12/20/11 now total balance is $200.
*date* *amount* *type* *balance* *counter*
12/20/11 $20 ATM $200 1
12/21/11 $30 Deposit $230 2
12/23/11 $30 ATM $200 3
10/01/11 $100 ATM $100 4
Now it should be show in table View as well as update in sqlite database. As this:
*date* *amount* *type* *balance* *counter*
10/01/11 $100 ATM $120 1
12/20/11 $20 ATM $100 2
12/21/11 $30 Deposit $130 3
12/23/11 $30 ATM $100 4
As I mentioned above before 12/20/11 balance was $220. There will be any number of transactions. Please let me know how it can be solved. I am stuck with this problem.
You should use "Order by" in sql query
for more information http://www.w3schools.com/sql/sql_orderby.asp