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 |
|
sg2255551
Constraint Violating Yak Guru
274 Posts |
Posted - 2010-09-29 : 01:52:20
|
| hiI have a tracking table that tracks products. It has a prodid and productname field. Presume i have 3 products tracked, 1, Apple2, Orange3, PearSo i wrote a stored proc to list out their details but it always show only pears. This is my code:Create Proc [dbo].[tracking]@ProductName nvarchar(50)With TrackProd AS ( Select ProdID, Productname from Tracking where Productname = @ProductName )SELECT ProductName , ProdDesc, ProdPrice, ProdQuantity From Product inner join TrackProd on Product .ProdID = TrackProd.PrdIDI know it can be done simply without CTE and join them based on their prodid. But because of the complexities, i need to use CTE. The solution of the example will allow me to combine CTE results in my actual enviroments. sorry for the inconveniences. ThanksHow to show all products? thanks |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2010-09-29 : 04:25:12
|
LEFT JOIN. N 56°04'39.26"E 12°55'05.63" |
 |
|
|
sg2255551
Constraint Violating Yak Guru
274 Posts |
Posted - 2010-09-30 : 02:16:48
|
| Thanks |
 |
|
|
|
|
|