包含其他非标准的其他列

时间:2017-01-30 22:23:11

标签: sql oracle crystal-reports

对不起,标题不清楚

我有一个脚本(使用Pl / Sql Oracle),我创建了一个报告,它将选择退出用户选择的城市列表。我有一个列将列出该城市,但我希望包含一个列出与该用户关联的其他城市的附加列(城市列表不应包括他/她对该列的选择)。

我不确定该怎么做,以便附加列不会列出所选择的城市或城市。有可以使用的功能吗?

我也在Crystal report 10上做过(如果有可能的话)

Iex:这只是我想要做的事情。

array("something" => "something else")

输出

##Table Name: Giving Cities##
##Andrew - Peru##
##Andrew - Venezuela##
##Andrew - France##
##​Paul - USA##

Pick cities where user = Andrew and  City = Peru

2 个答案:

答案 0 :(得分:0)

在SQL中添加额外的其他列:

select user,cities,'' as additional_columns from yourtable

答案 1 :(得分:0)

我认为这正是您所寻找的:SQL Query to concatenate column values from multiple rows in Oracle

看起来您正在尝试将多行的结果连接在一起。

至于不选择"选择"对于附加列的城市,您可能希望使用子选择。子选择允许您将不同的where子句应用于附加列。

select t.user, t.city, t2.concatenated_cities
from table t
inner join 
(
    select distinct <see above link for how to concatenate rows here> as concatenated_cities
    from table sub_t
    where sub_t.city <> 'CITY'
) t2
on t.user = t2.user
where t.city = 'CITY'
相关问题