-
Contributing Member
sql query help...
I have a table structure
MemberDetails
----------------
MembershipDetailsID PK
MembershipID FK
Benefits Varchar
A MembershipID can contain many benefits which can be added.
At the time of retrieval i want a query to fetch all the benefits for this MembershipID in a single record.
i.e in normal suitations my query to fetch benefits is as following...
select Benefits from MemberDetails where MembershipID=10; here i will get mutiple records.
what i want is a single record with Benefits values as comma seperated.
can you help me regarding this sub-query? is this posibble?is this question against the normalisation rules?
-
Contributing Member
Re: sql query help...
hi
give your table with data and one sample req. o/p
-
Expert Member
Re: sql query help...
Hi Suresh,
Let me first understand your question...
If the Benefits columns has multiple records like below,
BENEFITS
----------------
LOW
MEDIUM
HIGH
It has to to displayed as LOW, MEDIUM, HIGH. Am i right?
If this is your requirement, this can be definitely achieved using a procedure where the column value is fetched using a cursor & concatenating the retrieved values.
Last edited by Innila; 07-12-2007 at 06:31 AM.
*** Innila ***
-
Expert Member
Re: sql query help...
Suresh,
As Innila said i would suggest you to use cursors in pl/sql procedure in order to get this done.
There is an another thread under ORACLE. There so many work arounds have been discussed for such a similar requirement. That might give you some idea....
http://www.geekinterview.com/talk/49...can-i-use.html
-
Contributing Member
Re: sql query help...
Thanks to all of you for a quick reply....
-
Junior Member
Re: sql query help...
what is the query? you have not mentioned anything.
-
Re: sql query help...
dear
vunnavahh
please go through the previous posts before posting anything .
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules