sql查询语句,查数据库中一共多少条记录

发布于2022-01-12 18:40:53
4个回答
admin
网友回答2022-01-12
举例:查询学生表中有多少位男同学:
select count(*) from student_table where sex='男'
admin
网友回答2022-01-12
这个 这个 真没试过 读取一定顺序的六条数据倒是试过
admin
网友回答2022-01-12
%
'分页sql语句生成代码
Function GetPageSql(TblName,FldName,PageSize,PageIndex,OrderType,StrWhere)
Dim StrTemp,StrSql,StrOrder
'根据排序方式生成相关代码
If OrderType = 0 Then
StrTemp = (Select Max([ & FldName & ])
StrOrder = Order By [ & FldName & ] Asc
Else
StrTemp = (Select Min([ & FldName & ])
StrOrder = Order By [ & FldName & ] Desc
End If

'若是第1页则无须复杂的语句
If PageIndex = 1 Then
StrTemp =
If StrWhere Then
Strtmp = Where & StrWhere
End If
StrSql = Select Top & PageSize & * From [ & TblName & ] & Strtmp & StrOrder
Else '若不是第1页,构造sql语句
StrSql = Select Top & PageSize & * From [ & TblName & ] Where [ & FldName & ] & StrTemp & _
From (Select Top & (PageIndex-1) * PageSize & [ & FldName & ] From [ & TblName & ]
If StrWhere Then
StrSql = StrSql & Where & StrWhere
End If
StrSql = StrSql & StrOrder & ) As Tbltemp)
If StrWhere Then
StrSql = StrSql & And & StrWhere
End If
StrSql = StrSql & Str Order
End If
GetPageSql = StrSql '返回sql语句
End Function
Response.Write(GetPageSql(Message,MessageID,10,1,0,))
%
admin
网友回答2022-01-12
select count主码
form 表名

回到
顶部