Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/sql/69.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
SQL-between和_Sql - Fatal编程技术网

SQL-between和

SQL-between和,sql,Sql,这将再次发生: 1. 2. 3. 4. 五, 我需要一些帮助来推进这个问题。如何将查询设置为打印每个数字返回多次 例如: 打印1到5之间的数字,并每3次打印一个数字 最终结果: 1. 1. 1. 2. 2. 2. 3. 3. 3. 4. 4. 4. 5. 5. 五, 顺便说一句,我会在Jasper ireport中使用它,不想使用进程、函数等 请帮忙!提前感谢尝试使用以下corss连接 with bar_no as ( select 1 start_bar, 5 end_bar from dua

这将再次发生: 1. 2. 3. 4. 五,

我需要一些帮助来推进这个问题。如何将查询设置为打印每个数字返回多次

例如:

打印1到5之间的数字,并每3次打印一个数字

最终结果: 1. 1. 1. 2. 2. 2. 3. 3. 3. 4. 4. 4. 5. 5. 五,

顺便说一句,我会在Jasper ireport中使用它,不想使用进程、函数等


请帮忙!提前感谢

尝试使用以下corss连接

with bar_no as (
select 1 start_bar, 5 end_bar from dual)
select barcode
from (select level barcode
from dual
connect by level <= (select max(end_bar) from bar_no)) a
where exists (
select 1
from bar_no
where barcode between bar_no.start_bar and bar_no.end_bar)

试着使用下面的交叉连接

with bar_no as (
select 1 start_bar, 5 end_bar from dual)
select barcode
from (select level barcode
from dual
connect by level <= (select max(end_bar) from bar_no)) a
where exists (
select 1
from bar_no
where barcode between bar_no.start_bar and bar_no.end_bar)

您可以在with语句中生成序列,然后将它们连接在一起:

with bar_no as (
select 1 start_bar, 5 end_bar from dual)
select barcode
from (select level barcode
from dual
connect by level <= (select max(end_bar) from bar_no)) a
where exists (
select 1
from bar_no
cross join 
(
  select 1
  union all
  select 2
  union all
  select 3  
   ) CJ
where barcode between bar_no.start_bar and bar_no.end_bar)

您可以在with语句中生成序列,然后将它们连接在一起:

with bar_no as (
select 1 start_bar, 5 end_bar from dual)
select barcode
from (select level barcode
from dual
connect by level <= (select max(end_bar) from bar_no)) a
where exists (
select 1
from bar_no
cross join 
(
  select 1
  union all
  select 2
  union all
  select 3  
   ) CJ
where barcode between bar_no.start_bar and bar_no.end_bar)

您可以将此查询与另一个..连接方式level@SnowBlind你介意给我举个例子吗?检查@Gordon的答案,这就是我的意思。你可以用另一个…连接level@SnowBlind你介意给我举个例子吗?检查一下@Gordon的答案,这就是我的意思。谢谢Gordon!你回答得很快!这正是我想要的!谢谢谢谢戈登!你回答得很快!这正是我想要的!谢谢