What is the purpose of LIST function in Sybase?

 Posted by Niladri.Biswas on 9/12/2012 | Category: Others Interview questions | Views: 1494 | Points: 40
Answer:

It gives a comma separated list of value.

e.g. we have a table as under

ID     Name     Assets

------------------------------------
1 Bob Car
1 Bob Bicycle
1 Bob House
2 Jane Car
2 Jane House
3 Peter Boat
3 Peter Car
3 Peter Motorcycle


The needed output should be

ID     Name     Assets

------------------------------------
1 Bob Car,Bicycle,House
2 Jane Car,House
3 Peter Boat,Car,Motorcycle


Query

SELECT ID,NAME,LIST(ASSETS)

FROM SOMETABLE
GROUP BY ID,NAME


Asked In: Many Interviews | Alert Moderator 

Comments or Responses

Login to post response