如何从报告中删除重复的列值 [英] How do I remove repeated column values from report

查看:138
本文介绍了如何从报告中删除重复的列值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

从这里:

 酒店类型客房从
---------- --------------- ------ ---- ------------------------- ---------------- --------- ---------
University Inn& Suites双人间101 George Brown 11-SEP-10 14-SEP-10
University Inn& Suites双人间101 George Brown 11-OCT-10 13-OCT-10
University Inn& Suites双人房102
University Inn& Suites双人房103
University Inn& Suites Double 104
University Inn& Suites双人房105
University Inn& Suites家庭106 George Brooks 22-SEP-10 27-SEP-10
University Inn& Suites家庭107
University Inn& Suites单人间201 Sandra Williams 15-SEP-10 19-SEP-10
University Inn& Suites Single 201 Liz Armstrong 16-SEP-10 18-SEP-10
University Inn& Suites Single 201 Craig Harper 19-SEP-10 22-SEP-10
University Inn& Suites单人间202 Roger Harris 03-SEP-10 10-SEP-10
University Inn& Suites单间202 Tonya Harris 23-SEP-10 27-SEP-10
University Inn& Suites单人间203
University Inn& Suites单人间204
University Inn&套房单人间205

至此

 酒店类型客房来自
------------------------- ------ - --- ----------------------------------------- ------ --- ---------
University Inn& Suites双人房101 George Brown 11-SEP-10 14-SEP-10
George Brown 11-OCT-10 13-OCT-10
102
103
$ $
105
家庭106 George Brooks 22-SEP-10 27-SEP-10
107
单身201 Sandra Williams 15-SEP-10 19-SEP-10
201 Liz Armstrong 16 -SEP-10 18-SEP-10
Craig Harper 19-SEP-10 22-SEP-10
202 Roger Harris 03-SEP-10 10-SEP-10
Tonya Harris 23-SEP-10 27-SEP-10
203
204
205


<解决方案

这是你正在显示(或)的表格结构是否是报告的结果?



我的猜测是这是一个SQLPLUS报告的结果。如果是这种情况,并且您希望酒店名称出现一次(直到它改变),您可以指定

 打破酒店; 

从酒店选择酒店,类型,房间客人

酒店订购;

来达到预期的效果。

如果是结构体,则不能删除第一行以外的所有列值。 (事实上​​,就数据库而言,没有第一行)。如果您试图消除重复的数据,然后查看规范化您的表。



http://en.wikipedia.org/wiki/Database_normalization \



请发表表格描述和工具(if任何),这样你会得到适当的答案你的情况。


FROM THIS:

Hotel                     Type   Room Guest                                     From      To
    ------------------------- ------ ---- ----------------------------------------- --------- ---------
    University Inn & Suites   Double 101  George Brown                              11-SEP-10 14-SEP-10
    University Inn & Suites   Double 101  George Brown                              11-OCT-10 13-OCT-10
    University Inn & Suites   Double 102
    University Inn & Suites   Double 103
    University Inn & Suites   Double 104
    University Inn & Suites   Double 105
    University Inn & Suites   Family 106  George Brooks                             22-SEP-10 27-SEP-10
    University Inn & Suites   Family 107
    University Inn & Suites   Single 201  Sandra Williams                           15-SEP-10 19-SEP-10
    University Inn & Suites   Single 201  Liz Armstrong                             16-SEP-10 18-SEP-10
    University Inn & Suites   Single 201  Craig Harper                              19-SEP-10 22-SEP-10
    University Inn & Suites   Single 202  Roger Harris                              03-SEP-10 10-SEP-10
    University Inn & Suites   Single 202  Tonya Harris                              23-SEP-10 27-SEP-10
    University Inn & Suites   Single 203
    University Inn & Suites   Single 204
    University Inn & Suites   Single 205

TO THIS

    Hotel                     Type   Room Guest                                     From      To
    ------------------------- ------ ---- ----------------------------------------- --------- ---------
    University Inn & Suites   Double 101  George Brown                              11-SEP-10 14-SEP-10
                                          George Brown                              11-OCT-10 13-OCT-10
                                     102  
                                     103
                                     104
                                     105
                              Family 106  George Brooks                             22-SEP-10 27-SEP-10
                                     107
                              Single 201  Sandra Williams                           15-SEP-10 19-SEP-10
                                     201  Liz Armstrong                             16-SEP-10 18-SEP-10
                                          Craig Harper                              19-SEP-10 22-SEP-10
                                     202  Roger Harris                              03-SEP-10 10-SEP-10
                                          Tonya Harris                              23-SEP-10 27-SEP-10
                                     203
                                     204
                                     205

解决方案

Is this the structure of the table that you are showing (or) is it the result of a report?

My guess is it is the result of a SQLPLUS report. If that is the case, and you want the Hotel name to appear once (until it changes), you can specify

Break on hotel;

Select hotel, type, room_guest
  from hotels
  order by hotel;

to achieve the desired result.

If it the structure, you cannot delete the column values for all but the first row. (in fact, there is nothing like the first row as far as the database is concerned). If you are trying to eliminate duplicate data, then look into normalizing your table.

http://en.wikipedia.org/wiki/Database_normalization\

Please post the table description and the tool (if any) so that you'd get the appropriate answers for your case.

这篇关于如何从报告中删除重复的列值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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