兩個Recordset. 一個 select xxx from zzz 另一個 select @@rowcount as yyy兩語句一塊執行,取出兩個Recordset.(不過好像意議不大,你哪里看到的說recordcount的效率很低?有測試數據嗎?)
不可能效率很低 用 select count(*) as icount from table where ....
用select count(*) 效率很高的, 某些提供者根本不支持recordcount属性 可以用union语句,例如有表T,有字段a,b,c,条件为item 查询可以这样写: select 0 as recordcount,a,b,c from t where item union select count(*) as recordcount, null as a,null as b,null as c from t where item
to N_chow: 是N多ASP教材上说recordset的recordcount属性XXX... :)
select a.xxx ,b.y form zzz a cross (select count(xxx) as y from zzz )这样就可以了
一個
select xxx from zzz
另一個
select @@rowcount as yyy兩語句一塊執行,取出兩個Recordset.(不過好像意議不大,你哪里看到的說recordcount的效率很低?有測試數據嗎?)
用 select count(*) as icount from table where ....
某些提供者根本不支持recordcount属性
可以用union语句,例如有表T,有字段a,b,c,条件为item 查询可以这样写:
select 0 as recordcount,a,b,c from t where item
union
select count(*) as recordcount, null as a,null as b,null as c
from t where item
是N多ASP教材上说recordset的recordcount属性XXX...
:)
form zzz a cross (select count(xxx) as y from zzz )这样就可以了
gzhughie(hughie) mornwoo(疾风之虫)
的select语句我不太明白
如果是select出来一个char型的记录集,比如如人的名字
union后的count()是一个int型的,系统会报错吧?!
“将 nvarchar 值 'RMB' 转换为数据类型为 int 的列时发生语法错误。”
group by xxx