SQL-between和
这将再次发生: 1. 2. 3. 4. 五, 我需要一些帮助来推进这个问题。如何将查询设置为打印每个数字返回多次 例如: 打印1到5之间的数字,并每3次打印一个数字 最终结果: 1. 1. 1. 2. 2. 2. 3. 3. 3. 4. 4. 4. 5. 5. 五, 顺便说一句,我会在Jasper ireport中使用它,不想使用进程、函数等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
请帮忙!提前感谢尝试使用以下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!你回答得很快!这正是我想要的!谢谢谢谢戈登!你回答得很快!这正是我想要的!谢谢