通过电平< 2从双连接中选择电平的模拟.10& quot;对于Sybase? [英] Analog of "select level from dual connect by level < 10" for Sybase?

查看:41
本文介绍了通过电平< 2从双连接中选择电平的模拟.10& quot;对于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')

MINUS 的Sybase模拟中为:

In Sybase analog for MINUS is:

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

但我不知道按级别连接 ...

更新,有什么方法可以在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 );

这篇关于通过电平&lt; 2从双连接中选择电平的模拟.10&amp; quot;对于Sybase?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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