“通过级别从双连接选择电平” 10“对于Sybase? [英] Analog of "select level from dual connect by level < 10" for Sybase?

查看:166
本文介绍了“通过级别从双连接选择电平” 10“对于Sybase?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

通过从双连接级别选择级别< 10 在Oracle中,我可以生成整数的子查询,并将其转换为另一个序列。

By select level from dual connect by level < 10 in Oracle I can generate sub-query of integer and transform it to another sequence.

这可能是Sybase?

Is this possible with Sybase?

PS 我想查找表中没有数据的日期(缺少日期)。在Oracle中,我这样做:

PS I want to find dates where are no data in table (missing days). In Oracle I do this as:

select to_date('2012-01-01', 'yyyy-mm-dd')+level-1 from dual
    connect by level < to_date('2013-01-01', 'yyyy-mm-dd') - to_date('2012-01-01', 'yyyy-mm-dd')
  MINUS
select distinct date from TBL
    where date between to_date('2012-01-01', 'yyyy-mm-dd')
                   and to_date('2013-01-01', 'yyyy-mm-dd')

在Sybase中, MINUS 的模拟是:

In Sybase analog for MINUS is:

select whatever from table1 T1
  where not exists
  ( select 1 from table2 where id = T1.id )

但我不知道按连接的模拟...

but I don't know analog for connect by level...

UPDATE 有没有办法在Sybase中创建临时表,而不会将数据实际存储到磁盘?

UPDATE Is there any way to create temporary table in Sybase without actually storing data to disk?

推荐答案

您使用的Oracle语法是用作行生成器的分层查询。 Sybase具有 sa_rowgenerator 系统过程可用于生成一个开始和结束值之间的整数。

The Oracle syntax you use is a hierarchical query used as a row generator. Sybase has the sa_rowgenerator system procedure can be used to generate a set of integers between a start and end value.

以下内容将生成1到255之间的整数列。

The following will produce a column of integers between 1 and 255.

SELECT row_num FROM sa_rowgenerator( 1, 255 );

这篇关于“通过级别从双连接选择电平” 10“对于Sybase?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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