2012-01-18 30 views
-3

如何找出查询返回的记录数?SQL:选择记录数

例如,我有一个名为Items的表,每个项目都有一个子类型ID。如何找出属于子类型1的项目的行数?

回答

0

您可以使用下面的查询。

select count(*) from items where item_subtype_id=1; 
3

您是否阅读过SQL的介绍?

select count(*) 
from items 
where subtype = 1 

:)

0
select count(*) from Items where subtype_id = 1