惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

GbyAI
GbyAI
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
博客园 - 叶小钗
大猫的无限游戏
大猫的无限游戏
H
Help Net Security
G
Google Developers Blog
D
Docker
阮一峰的网络日志
阮一峰的网络日志
A
About on SuperTechFans
aimingoo的专栏
aimingoo的专栏
博客园 - 聂微东
Hugging Face - Blog
Hugging Face - Blog
酷 壳 – CoolShell
酷 壳 – CoolShell
Apple Machine Learning Research
Apple Machine Learning Research
云风的 BLOG
云风的 BLOG
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
腾讯CDC
T
The Blog of Author Tim Ferriss
Microsoft Security Blog
Microsoft Security Blog
WordPress大学
WordPress大学
I
InfoQ
Engineering at Meta
Engineering at Meta
Stack Overflow Blog
Stack Overflow Blog
Google DeepMind News
Google DeepMind News

博客园 - 真的很菜

用户中心 - 博客园 求助:DataGrid加行号的问题 C++Builder 2007 一个JS的问题,请帮下忙! 对谷歌输入发的一点疑虑 开始练习VS2003了 VC++.NET编译的问题 Visual studio 2005 sdk 安装引起的后果 几个微软的好东西! SQL 查询,请帮忙 Visual studio 已安装模版错误怎么解决? 想学ASP建站,有几个问题,请帮忙解决,谢谢! Win2003 IIS配置asp的问题 不要轻易删除/windows/install下文件 xp下安装sqlserver2000提示有挂起 Daemon Tools手工完全卸载方案 [转]将visual studio 2005 SP1补丁整合到安装文件 转:FTP命令全集(收藏) TurboTweaks-解除Turbo Explorer限制
SQL查询结果的合并问题
真的很菜 · 2007-04-01 · via 博客园 - 真的很菜

求-10~10之间的正整数的个数

我用

declare @a int
set @a=-10
if (@a between -10 and 10)
    
begin
        
while (@a<=10)
            
begin
                
select @a,case when @a>0 then 1
                        
else 0
                
end as 'Y'
                
set @a=@a+1
            
end
    
end

查询出了如下结果
   Y
----------- -----------
-10         0

(1 行受影响)

            Y
----------- -----------
-9          0

(1 行受影响)

            Y
----------- -----------
-8          0

(1 行受影响)

            Y
----------- -----------
-7          0

(1 行受影响)

            Y
----------- -----------
-6          0

(1 行受影响)

            Y
----------- -----------
-5          0

(1 行受影响)

            Y
----------- -----------
-4          0

(1 行受影响)

            Y
----------- -----------
-3          0

(1 行受影响)

            Y
----------- -----------
-2          0

(1 行受影响)

            Y
----------- -----------
-1          0

(1 行受影响)

            Y
----------- -----------
0           0

(1 行受影响)

            Y
----------- -----------
1           1

(1 行受影响)

            Y
----------- -----------
2           1

(1 行受影响)

            Y
----------- -----------
3           1

(1 行受影响)

            Y
----------- -----------
4           1

(1 行受影响)

            Y
----------- -----------
5           1

(1 行受影响)

            Y
----------- -----------
6           1

(1 行受影响)

            Y
----------- -----------
7           1

(1 行受影响)

            Y
----------- -----------
8           1

(1 行受影响)

            Y
----------- -----------
9           1

(1 行受影响)

            Y
----------- -----------
10          1

(1 行受影响)

结果是分开的,不能做sum操作,请问怎么把结果合并 我用union all 老出错

还有就是

@Value % 2 == 0? "even":"odd"


怎样查询
我在前面加select ,提示'=' 附近有语法错误。
谢谢