query help, please

  • From: iwei16@xxxxxxxxx
  • To: oracle-l@xxxxxxxxxxxxx
  • Date: Sat, 11 Aug 2007 23:34:29 -0400

I have the following query:

select table_name, table_name_id, count(*)
from approved_tables
group by table_name, table_name_id
order by count(*) desc

TABLE_NAME         TABLE_NAME_ID            COUNT(*)
----------------  -------------  -------------  -----------
eHA_Cont_P     1153600965418             5254
CSElent         1151606341446               5179
CSElent         1151606341460               5163
eHA_Cont_P     1151606276700             3808
Page              1155140051116              3805


The data in the TABLE_NAME column are the names of tables.
I need  to query the data for the TABLE_NAME column using TABLE_NAME_ as the
FK
(for example: select name from eHA_Cont_P where id = 1153600965418;
----
xxx
)
and
need to see the output from the above query with the resulting "NAME"
value.

So I need something like this:
TABLE_NAME         TABLE_NAME_ID            COUNT(*)  NAME
----------------  -------------  -------------
-------------------------------------------
eHA_Cont_P     1153600965418             5254        XXX
CSElent         1151606341446               5179        YYY
CSElent         1151606341460               5163        ZZZ
eHA_Cont_P     1151606276700             3808        WWW
Page              1155140051116              3805        VVVV


How would I do that?

Please help.

Thanks.

Other related posts: