select count(*) from ( select tmh from TDATA group by tmh ) m
select count(*) from ( select tmh from TDATA group by tmh ) tb
SQL 必须要加个别名,微软规定的。
select count(distinct tmh) from TDATA
Select Count(1) from ( Select tmh From TDATA Group By tmh ) Table 正解,顶
原来是FIREBIRD数据库来的,它就不用加上别名,搞晕我了,查了一个多小时了...
这个叫派生表,是一种从查询表达式派生出虚拟结果表的表达式,使用派生表的形式如下: from (derived_table_query expression) as derived_table_alias
来晚了,加个别名就可以了。 select count(*) from ( select tmh from TDATA group by tmh ) aa
select count(*) from ( select tmh from TDATA group by tmh ) TT 加个表别名
select count(*) from ( select tmh from TDATA group by tmh ) table1
select count(*) from ( select tmh from TDATA group by tmh ) as a这种from 一个子句的一定要加个别名 有的情况比如链接 select * into aa from (select * from a where id>30) as a 这样的也是一样一定要加别名,有的时候比如用子句来进行join 关联,也是要加别名的。
--加个别名 select count(*) from ( select tmh from TDATA group by tmh ) A
select count(*) from ( select tmh from TDATA group by tmh ) name -- 加个名字,告诉前面的人:我这是一个表啊
晕,又忘了 UBB里是不能改变颜色的。
早点来就好了, select count(a.*) from ( select tmh from TDATA group by tmh ) as a 只有顶了
Select Count(1) from ( Select tmh From TDATA Group By tmh ) Table
正解,顶
from (derived_table_query expression) as derived_table_alias
select count(*) from ( select tmh from TDATA group by tmh ) aa
加个表别名
select count(*) from ( select tmh from TDATA group by tmh ) as a这种from 一个子句的一定要加个别名
有的情况比如链接
select * into aa from (select * from a where id>30) as a
这样的也是一样一定要加别名,有的时候比如用子句来进行join 关联,也是要加别名的。
select count(*) from ( select tmh from TDATA group by tmh ) A
select count(*) from ( select tmh from TDATA group by tmh ) name
-- 加个名字,告诉前面的人:我这是一个表啊
select count(a.*) from ( select tmh from TDATA group by tmh ) as a
只有顶了