我有一个简单的查询,该查询从OrderLine
表返回结果。是否有一种方法可以在视觉上分隔查询结果,以使其更易于阅读(如此处所示的图像)?
SELECT [OrderNo], [LineNo]
FROM [OrderLine]
结果:
答案 0 :(得分:1)
您可以像这样执行多个查询:
.then((data: [Dogs, Cats])
答案 1 :(得分:1)
drop table if exists #OrderLine;
select object_id as OrderNo, abs(checksum(newid())) as [LineNo]
into #OrderLine
from sys.columns;
-- ... results to text (ctrl+T)?
select OrderNo, [LineNo],
case when lead(OrderNo, 1) over(partition by OrderNo order by OrderNo) = OrderNo then '' else replicate('-', 11) + char(10) end
from #OrderLine;
--inject NULL
select case when [LineNo] is null and flag=2 then null else TheOrderNo end as OrderNo, [LineNo]
from
(
select OrderNo AS TheOrderNo, [LineNo], 1 as flag
from #OrderLine
union all
select distinct OrderNo, NULL, 2
from #OrderLine
) as src
order by TheOrderNo, flag;
答案 2 :(得分:0)
您不能直接这样做。也许添加一个新列,该列要么为空,要么为空,以使其交替。 像这样:
select ..., case when rank() over (order by OrderNO) % 2 then 'XXX' else null end
from....
%2是一个“模”运算符...