Unix Technical Forum

Outer Joins, decode, case combinations : Anyone ?

This is a discussion on Outer Joins, decode, case combinations : Anyone ? within the Oracle Miscellaneous forums, part of the Oracle Database category; --> I have a query that shows a result-set in which shows some columns including one on which the result ...


Go Back   Unix Technical Forum > Database Server Software > Oracle Database > Oracle Miscellaneous

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 04-08-2008, 10:29 AM
aroy.dba@gmail.com
 
Posts: n/a
Default Outer Joins, decode, case combinations : Anyone ?

I have a query that shows a result-set in which shows some columns
including one on which the result gets sorted out.

We want to have three fields in the result set:
1. GroupName (from table1)
2. UsrName (from table2)
3. Sub-GroupName (from table3)

We have three groups(GrpA, Grp2, Grp3)
*GrpA has a member A
*GrpB has a member B
*GrpC has a member C

*GrpC is sub-group of GrpB
*GrpB is sub-group of GrpA

( There is a table that stores who is sub-group of whom. )

We want the display to look like this :

-------------------------------------------------------------
GroupName UsrName Sub-GroupName
--------------------------------------------------------------
GrpA A
GrpA B grpB
GrpA C grpC

The GrpA with '*' in the column GroupName is not the actual GroupName
value for the sub-group, that goes to column three. (How to apply these
conditions ? [for Main group the actual entry and for sub-group
psuedo-entry ] and How to make a pseudo-entry in GroupName Column for a
record which is a subgroup but has this same column-name ? )

But it has to be shown just like that for the sub-groups. So
effectively, Actual GroupName of the sub-group members go to the
Sub-GroupName column only and not to the name of the grpName. (The
actual value of the GrpName for the sub-group query, goes to the
sub-group column. How to go about it !)

Possibly combination of Outer Joins, decode, case is to be used but we
need to check that up.

I've tried to keep the picture simple. Plz let me know if more details
are required.

Amit

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 04-08-2008, 10:29 AM
Mark D Powell
 
Posts: n/a
Default Re: Outer Joins, decode, case combinations : Anyone ?

If you really want someone to assit you on this shouldn't you have
provided 3 create table statements with insert statements to populate
the tables with a minimum amount of data?

You should also always include the Oracle edition and version since
features are edition/version dependend.

The solution will depend on how your data is orgranized and how the
tables are related. Someone could guess but he or she would be wasting
their time if your design was different from what was expected.

HTH -- Mark D Powell --

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 06:44 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
www.UnixAdminTalk.com