请问一下,将两个不同的查询的结果放在同一表中返回该怎么写? 本帖最后由 bllqbz 于 2011-07-12 18:53:00 编辑 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 SELECT count1=COUNT(case when Content='How' then 1 else null end), count2=COUNT(case when Parent=1 then 1 else null end),FROM table1 select (SELECT COUNT(*) FROM table1 WHERE Content='How') cn1, (SELECT COUNT(*) FROM table WHERE Parent=1) cn2 select COUNT(*) cn1, (SELECT COUNT(*) FROM table WHERE Parent=1) cn2FROM table1 WHERE Content='How' --orselect (SELECT COUNT(*) FROM table1 WHERE Content='How') cn1, COUNT(*) cn2FROM table WHERE Parent=1 跪: 一个数据库附加的问题,客户近两年都数据都在里面,不知如何是好. 请问一个查询语句? 问一个关于双重查询的问题 怎么在查询分析器里运行有输入输出参数的存储过程 请教一个sql server的问题 关于设计表的问题 请教日志传送的问题! sql怎样删记录? 游标问题请求(马可、邹建)给予帮助 头疼的问题:如何在SQL中实现 SELECT name,Max(bit_1) as bit_exp FROM aTable GROUP BY name 如何对两个查询结果进行横向联合? 酒店预订语 住很多天
SELECT count1=COUNT(case when Content='How' then 1 else null end),
count2=COUNT(case when Parent=1 then 1 else null end),
FROM table1
select (SELECT COUNT(*) FROM table1 WHERE Content='How') cn1,
(SELECT COUNT(*) FROM table WHERE Parent=1) cn2
select COUNT(*) cn1,
(SELECT COUNT(*) FROM table WHERE Parent=1) cn2
FROM table1
WHERE Content='How'
--orselect (SELECT COUNT(*) FROM table1 WHERE Content='How') cn1,
COUNT(*) cn2
FROM table
WHERE Parent=1