SELECT TABLENAME
FROM BASE5.SYS_FORM_INFO
where ISFLAG = 1
结果:
当我使用count()来包含它时。
SELECT count(*) from (
SELECT TABLENAME
FROM BASE5.SYS_FORM_INFO
where ISFLAG = 1
)
结果:
[Err] 42000 - [SQL Server]')'
附近的语法错误SELECT count(*) from FE_APP5.dbo.FT_001_84D7B91BDD9F26F2178E
结果:
所以,我的问题是如何计算我选择的一些表格?
答案 0 :(得分:3)
您需要子查询的别名:
SELECT count(*) as cnt
FROM (SELECT TABLENAME
FROM BASE5.SYS_FORM_INFO
WHERE ISFLAG = 1
) x;
我假设您知道子查询不是必需的:
SELECT COUNT(*) as cnt
FROM BASE5.SYS_FORM_INFO
WHERE ISFLAG = 1