如何获得这条sql语句的总条数?谢谢
select distinct m.* from mediaPack m left join MetaDataRecord b on m.id = b.MediaPackID where m.discBarcode is not null and m.name like '%%' 如何获得查询记录的总条数最好是查询并赋值的那种,因为我是写在存储过程里面的。 SQL2008
[解决办法]
select distinct m.* from mediaPack m
left join MetaDataRecord b on m.id = b.MediaPackID
where m.discBarcode is not null and m.name like '%%'
select @@ROWCOUNT as 总条数
select *,COUNT(1) as总条数 from(
select distinct m.* from mediaPack m
left join MetaDataRecord b on m.id = b.MediaPackID
where m.discBarcode is not null and m.name like '%%'
) as w
[解决办法]
select COUNT(1) as总条数 from(
select distinct m.* from mediaPack m
left join MetaDataRecord b on m.id = b.MediaPackID
where m.discBarcode is not null and m.name like '%%'
) as w