January 21, 2011 at 2:18 am
Hi,
I am using the below query in my sql. Here is four table. I join the table and i show that what output i need.
Select Reqid,Name,Status,E.ProPName
from ReqMaster R join ProjMaster P on R.Id=P.id join Systext S on S.sid=P.sid
join ExtDef D on S.ExtId=E.ExtID
this returns
multiple rows for sing req id with different value for property like
Reqid Name Status ProppName
1 hhhh jjj klkkj
1 hhhh jjj kjgfff
1 hhhh jjj nnnnnn
but i want the result as
Reqid Name Status PropName1 PropName2 PropName3
1 hhhh jjj klkkj kjgfff nnnnnn
Hope awaiting for your's reply guys.
Regards
Guvera
January 21, 2011 at 2:22 am
Lookup the PIVOT function. You'll have to create a column in the table/result set that the PIVOT will work from that will give names to each row though. Shouldn't be too hard, just append a ROW_NUMBER() function to 'PROC' as a column, and then use that as a subquery to the PIVOT command.
If you'd like better tested code, check out the first link in my signature to show you how to set it up so we can easily use it.
Never stop learning, even if it hurts. Ego bruises are practically mandatory as you learn unless you've never risked enough to make a mistake.
For better assistance in answering your questions[/url] | Forum Netiquette
For index/tuning help, follow these directions.[/url] |Tally Tables[/url]
Twitter: @AnyWayDBA
January 21, 2011 at 2:39 am
pivot will work only if each rid has given number of pids.
In your case it is 3.
if any rid having more then 3 pids it will fails.
January 21, 2011 at 2:47 am
Hi,
Thanks for your reply. I am using PIVOT table concept already. I am using Oracle 10g. 10g version is not supported PIVOT Table.
Thats why i think that using sql query through oracle 10g is it possible?
Thanks
January 21, 2011 at 2:47 am
Hi,
Thanks for your reply. I am using PIVOT table concept already. I am using Oracle 10g. 10g version is not supported PIVOT Table.
Thats why i think that using sql query through oracle 10g is it possible?
Thanks
January 21, 2011 at 3:02 am
Guvera (1/21/2011)
Hi,Thanks for your reply. I am using PIVOT table concept already. I am using Oracle 10g. 10g version is not supported PIVOT Table.
Thats why i think that using sql query through oracle 10g is it possible?
Thanks
No idea. I would recommend asking on an Oracle forum. This is the 2k5 forum for SQL Server. There's an actual Oracle forum here, but I don't know how much it's used. You'll find it from the main forum list though.
Never stop learning, even if it hurts. Ego bruises are practically mandatory as you learn unless you've never risked enough to make a mistake.
For better assistance in answering your questions[/url] | Forum Netiquette
For index/tuning help, follow these directions.[/url] |Tally Tables[/url]
Twitter: @AnyWayDBA
Viewing 6 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply