开发者

how to return the lastest info using sql

i want to get the lastest info in the databse using sql ,

this is my datbase's table

how to return the lastest info using sql

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
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜