在VB中如何对ACCESS数据库中的数据进行统计和排序:
例如:
在db.mdb书机可中有一张表A,表A中的数据如下:
bookname times(被借次数)
英语 4
语文 5
数学 7
. .
. .
现在要对这些数据进行统计,并用Label控件将被借次数排在前n位的显示出来,该如何办啊?
例如:
在db.mdb书机可中有一张表A,表A中的数据如下:
bookname times(被借次数)
英语 4
语文 5
数学 7
. .
. .
现在要对这些数据进行统计,并用Label控件将被借次数排在前n位的显示出来,该如何办啊?
select * from A whre times>=4 order by times desc试试看
排前5的数据
不过要做成参数的话
dim borrowtimes as integer
dim sqlborrow as string
borrowtimes =(前n位)
sqlborrow="select top "&cstr(borrowtimes)&" * from A order by times desc
"