sql查询的结果集(row_number do dim dim dim dos)
使用dbeaver一些自定义的Sybase驱动程序。 row_number不起作用:
不正确的语法附近“ over”
select row_number() over(), name
from table
也尝试了此
over (order by (select 1))
over (order by name)
尝试的变量:
SELECT语句分配值不得与数据回程操作结合使用,
declare @num int
set @num = 1
select name, @num = @num + 1
from table
cross join (select @num = 1)
然后使用主int键考虑临时表
using dbeaver some custom sybase driver.
row_number doesn't work:
incorrect syntax near 'over'
select row_number() over(), name
from table
tried also this
over (order by (select 1))
over (order by name)
tried variables:
select statement that assigns a value must not be combined with data-retrieval operations
declare @num int
set @num = 1
select name, @num = @num + 1
from table
cross join (select @num = 1)
Thinking about temporary table with primary int key
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(6)
如果
名称
列具有唯一名称,则可以使用子查询将行编号如下:If
name
column has unique names then you can use subquery to get your row numbered as below:您可以创建一个带有身份(称为行号)的新临时表,该表将列举行为ID,然后返回该表。
您可以尝试将其变为身份的值,因为我不知道它的作用。
You can create a new temp table with Identity (call it row number) that will enumerate the rows as IDs and then return that table.
You can experiment with the value passed into Identity as I don't know what it does.
啊。旧问题再次...
首先,ASE并没有像智商那样支持窗口功能。 row_number()aver()..
但是您可以使用另一个ASE的功能获得类似的效果 - 身份(n)
这是一个简单的示例 -
请注意 - 此函数 - 身份(n) - 只能在“ select in to to to”语句中使用,因此您需要使用它并将结果集放在temp表中,然后将其放在temp表中生成的隆起。
希望它有帮助。
ah. Old question again...
First, ASE didn't suppor the window function like IQ -- eg. this row_number() over ()..
But you can get the similar effect using another ASE's function -- identity(n)
Here's a simple Sample --
Pls be noted -- this function -- identity(n) -- can only be used in "select into" statement, so you need to use it and put the resultset to a temp table then retrieve it with the generated rownumber.
Hope it help.
count()
也是返回行号尝试这个
COUNT()
is also return number of rowTry This
Over()
在此指定一个列名和<代码>作为用于设置列的名称和行列
尝试此
OVER()
in that specify one column name andAS
is use to set name of column and row columnTry this
由临时表实现:
Alter表#tempt
添加ID数字(10,0)身份而不是null
realized by temporary table:
alter table #tempTable
add id numeric(10,0) identity not null