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 |
|
janise
Starting Member
1 Post |
Posted - 2002-10-02 : 23:05:33
|
| Please help me on this.I am writing a sql, perhaps a stored procedure; my boss has not decided yet but one thing that is clear is that we want to write a query that says we want to know how many colors are assigned to a given car.For instance,if a car named toyota has 15 colors, how can I query this so that we can look at the report and say carID has 15 colors and those 15 colors are printed out on the screen.I want to group it so that we can see clearly that 15 colors are assigned to carID 1, 10 colors to carID2 etc and those colors will be listed like color1 carID1 color2 up to colorN From the example above, we can see that carID1 has Ncolors listed from color1 to colorNI hope I am clear.Please help me code the query.Thank you in advance |
|
|
nr
SQLTeam MVY
12543 Posts |
Posted - 2002-10-03 : 05:02:48
|
| You would supply the data from the stored procedure but the presentation should be done from a client app.It depends on how the data is stored as to what the sql will look likeSomething like this maybeselect Car.Name, Coulor.Namefrom Carjoin CarColour on Car.ID = CarColour.Car.IDjoin Colour Colour.ID = CarColour.Car.IDorder by Car.Name, Coulor.Name==========================================Cursors are useful if you don't know sql.DTS can be used in a similar way.Beer is not cold and it isn't fizzy. |
 |
|
|
|
|
|