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 is the difference between fastload and multiload?

1461


What is a clique?

1152


What is bteq script in teradata?

1211


How to explain project Architecture and flow in teradata interviews?Can please anyone help on this? Am new to teradata.

4421


Highlight the limitations of TPUMP Utility.

1174


What is real time and near real time data warehousing?

1159


List out teradata data types?

1062


If RDBMS is halted what will you do ?

2220


What is meant by a Channel Driver?

1330


In a table can we use primary key in one column and in another column both unique and not null constrains.if yes how?

1242


How to run a query in teradata?

1144


Syntax for case when statement?

1115


There is a column with date in it. If I want to get just month how it can be done? Can I use sub string?

1149


How can we check the version of Teradata that we are using currently?

1107


How to write the query . eid enm doj dob i want to display the names who worked more than 25 years .

1824