Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

stumped with a tough joined query

Status
Not open for further replies.

fcoomermd

Programmer
Nov 20, 2002
218
CA
I have a table person, and a table called cars
I would like to set up a query that joins the table ex.

"select p.firstname, p.lastname, c.carType from person p, cars c where p.id=c.pid"
the tables are obviously 1 to many

I would like the returned result to look like this

Bob, Jones, Porche, Buick, Ferrrari
Dan Smith Chevy, Toyota, Honda, Suzukit, GMC

How can this be done... Spent too much time, and I am no closer... Any help would be apprciated.
Thanks
FC
 
I just posted a reply in another thread. Obviously, the tables are different, but the process could be the same.

Here is the thread: thread183-1151143

Create a udf where you pass in the PersonId, and it returns a comma delimited string of car types. With a little effort, you chould be able to get it to work.

If, after trying this method, you get stumped, post your code and I'll help some more.

-George

Strong and bitter words indicate a weak cause. - Fortune cookie wisdom
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top