i want to get the lastest info in the databse using sql ,
this is my datbase's table
what can i 开发者_如何学Godo ,
i want to get the last address_reality
the table's name is 'location'
thanks
You can use DESC in the SQL query to get the results in descending order from Database.
Then use this query if you are incrementing a primary key id.
String sql = "SELECT a.id,a.type,a.remark from accounts_command_type a WHERE a.response = '"
+ response + "' ORDER BY a.id DESC";
You will need to add one more column to the table which is primary key and autoincremented locationid for example. Then you can use below query.
SELECT TOP 1 address_reality from location order by locationid DESC
精彩评论