Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

Hello Frndz,
I have a table named product as shown below:
product_id product_name
1 AAA
1 BBB
1 CCC
2 PPP
2 QQQ
2 RRR

Now my output should be:
product_id product_name_1 product_name_2 product_name_3
1 AAA BBB CCC
2 PPP QQQ RRR

Answer Posted / vishvajeet mistry

We can also use Full outer join in this case.

sel
t1.pid,
t1.pn as pn1,
t2.pn as pn2,
t3.pn as pn3
from
(sel pid,pn
from prod
qualify rank() over (partition by pid order by pn)=1)t1
Full outer join
(sel pid,pn
from prod
qualify rank() over (partition by pid order by pn)=2)t2
On
t1.pid=t2.pid
Full outer join
(
sel pid,pn
from prod
qualify rank() over (partition by pid order by pn)=3)t3
on
t1.pid=t3.pid
order by 1 ;


Hope it helps :)

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are default access rights in teradata? What explicit right can be given to a user?

1113


What is the meaning of Caching in Teradata?

1141


What are the things to be considered while creating secondary index?

1101


What are the steps involved in the process flow of the sql statement through channel attached system?

1113


What is the difference between union and union all in teradata?

1128


What are the joins in teradata?

1019


What is basic teradata query language?

1118


Steps to create a data model?

1142


How to find duplicates in a table?

1220


How many codd's rules are satisfied by teradata database?

1115


If the PMON is not working then how do you manage and monitor all processes, resources and sessions etc.

2172


What is meant by a Highest Cost Plan?

1063


List out teradata data types?

1018


What are teradata utilities?

1115


Describe the between keyword in teradata?

1042