SELECT查询中的即时增量 [英] Instant increment in SELECT query

查看:86
本文介绍了SELECT查询中的即时增量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好朋友,



最近我正在尝试跟踪查询,但我无法获得输出..

所以任何人都可以帮助我输出..



我有这样的查询



Hello Friends,

Recently i am trying following Query, but i cant get output..
So can anyone help me out for Output..

I have Query Like this

DECLARE @i BIGINT = 1
SELECT A = ( CASE WHEN 1 = 1 THEN @i+=1 ELSE 0 END )



我想在执行此查询后输出 2 ..

意味着我可以用@ i ++或@ i + = 1等增加整数值吗?

如果没有那么在这种情况下我该怎么做?

这是可能??请尽快帮助..

感谢大家。



我尝试过的方法:




I want output 2 after execution of this Query..
Means can i increate integer value With @i++ or @i+=1 or etc??
If not then what should i have to do in this case??
Is this possible?? Please help as early as possible..
Thanking You all.

What I have tried:

DECLARE @i BIGINT = 1
SELECT A = ( CASE WHEN 1 = 1 THEN @i+=1 ELSE 0 END )

推荐答案

DECLARE @i BIGINT = 1

选择A =(情况1 = 1然后@ i + 1 ELSE 0结束)



使用此
DECLARE @i BIGINT = 1
SELECT A = ( CASE WHEN 1 = 1 THEN @i+1 ELSE 0 END )

use this


这篇关于SELECT查询中的即时增量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆