Need Help in one Query

5 views
Skip to first unread message

fasi rehman

unread,
Oct 13, 2009, 11:36:37 AM10/13/09
to oracle-...@googlegroups.com
Hi Folks, 
I have table Dept with details like

DeptId Dname Dlocation
10 Finance Del
20 Sales Mum
30 Marketing Blore

The output should be in this format

10 20 30
Finance
Sales Marketing
Del Mum Blore


Can anyone help me out in this ?
 
Regards,
Fasi


Add whatever you love to the Yahoo! India homepage. Try now!

ddf

unread,
Oct 13, 2009, 3:01:21 PM10/13/09
to Oracle in World
Comments embedded.

On Oct 13, 10:36 am, fasi rehman <fasi_...@yahoo.co.in> wrote:
> Hi Folks, 
> I have table Dept with details like
>
> DeptId Dname Dlocation
> 10 Finance Del
> 20 Sales Mum
> 30 Marketing Blore
>

Clearly this is homework. Ask your instructor for assistance on this
as we have no clear information on what topics your instructor has
covered nor do we know how your instructor as determined this problem
is to be solved.

> The output should be in this format
>
> 10 20 30
> Finance Sales Marketing
> Del Mum Blore
>
> Can anyone help me out in this ?
>  

Again, ask your instructor.

> Regards,
> Fasi
>
>       Now, send attachments up to 25MB with Yahoo! India Mail. Learn how.http://in.overview.mail.yahoo.com/photos


David Fitzjarrell

fasi rehman

unread,
Oct 13, 2009, 3:22:07 PM10/13/09
to oracle-...@googlegroups.com
Hi David,
 
I got this question from geekinterview.com website.
Just we need to swap rows & columns with headings off.
One of the members posted this question & it looked interesting.
So i asked over here in this forum.
Your answer was harsh & inappropriate.
Please dont discourage others from answering it.
 
Regards,
Fasi

--- On Wed, 14/10/09, ddf <ora...@msn.com> wrote:


Connect more, do more and share more with Yahoo! India Mail. Learn more.

ddf

unread,
Oct 13, 2009, 4:47:47 PM10/13/09
to Oracle in World
Comments embedded.

On Oct 13, 2:22 pm, fasi rehman <fasi_...@yahoo.co.in> wrote:
> Hi David,
>  
> I got this question from geekinterview.com website.

A fact which should have been stated at the outset.

> Just we need to swap rows & columns with headings off.

I know WHAT needs to be done, yet there are at least two ways to
accomplish this task and were it actual homework the instructor would
have provided specific instructions on how to solve it.

> One of the members posted this question & it looked interesting.

Again, something which should have been stated at the beginning.

> So i asked over here in this forum.
> Your answer was harsh & inappropriate.

No, it was neithier harsh nor inappropriate. You failed to post
relevant information with this query to distinguish it from homework.
.
> Please dont discourage others from answering it.

You really need to submit complete posts if you want someone to assess
this as something other than homework.
>  
> Regards,
> Fasi
>
> --- On Wed, 14/10/09, ddf <orat...@msn.com> wrote:

Rashid Mahmood

unread,
Oct 15, 2009, 8:27:31 AM10/15/09
to oracle-...@googlegroups.com
simply write if you are using oracle 9i the following query
 
select wm_concat(column_name) from table_name; ok
--
Rashid Mahmood

ddf

unread,
Oct 15, 2009, 2:13:34 PM10/15/09
to Oracle in World


On Oct 15, 7:27 am, Rashid Mahmood <mras...@gmail.com> wrote:
> simply write if you are using oracle 9i the following query
>
> select wm_concat(column_name) from table_name; ok
>
>
>
>
> --
> Rashid Mahmood- Hide quoted text -
>
> - Show quoted text -


This solves the problem ... how? Yes, the WMSYS.WM_CONCAT function
will concatenate column results into a single string however it
appears the OP wants three separate rows of concatenated values where
your solution, as written, concatenates ONE column of values. You've
proposed this as a solution when, in actuality, it's only part of the
complete answer. And there are several ways to do what the OP has
asked, including using pivot tables. Provide a complete solution for a
problem, not simply the starting point.


David Fitzjarrell
Reply all
Reply to author
Forward
0 new messages