Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
maxim
Yak Posting Veteran
51 Posts |
Posted - 2007-05-24 : 20:41:02
|
Hello, I have a very basic question (I think...)I will simplify my problem:I have two tablestbl_users: usrID int, usrName varchar(100)tbl_cars: usrID int, carID intSome Users have more than one car, but i want to generate a table from an sqlProcedure with:UsrID | UsrName | UsrCarsID's:12 | mike | 1, 3, 4How can I select all cars that one user have on a subQuery?I hope you understand me...Thanks |
|
khtan
In (Som, Ni, Yak)
17689 Posts |
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2007-05-26 : 03:53:41
|
Alternatively, if you use front end application, you can easily concatenate data thereWhere do you want to show data?MadhivananFailing to plan is Planning to fail |
 |
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2007-05-26 : 03:54:56
|
Your subject sounds that you got that error MadhivananFailing to plan is Planning to fail |
 |
|
maxim
Yak Posting Veteran
51 Posts |
Posted - 2007-05-29 : 21:10:35
|
Thanks!!That UDF (posted by khtan) solve my problem.madhivanan, i use a front-end application but i prefer to manage all the data in one sqlProcedure.If i had used an front-end app, and if i have a table with 200 users I needed 200 new connections to receive all the cars of wich one!With UDF, i only need one connection!Thanks to both.(Sorry my bad english) |
 |
|
jsmith8858
Dr. Cross Join
7423 Posts |
Posted - 2007-05-29 : 22:15:23
|
>>If i had used an front-end app, and if i have a table with 200 users I needed 200 new connections to receive all the cars of wich one!No ... you just need a single SQL statement, with a single connection. Why would you think you need 1 connection per row????- Jeffhttp://weblogs.sqlteam.com/JeffS |
 |
|
|
|
|
|
|