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 |
|
darenkov
Yak Posting Veteran
90 Posts |
Posted - 2007-10-07 : 04:55:14
|
| i don't understand this error:this is my code but i the following error:Msg 4104, Level 16, State 1, Line 10The multi-part identifier "S.Rank" could not be bound.Msg 104, Level 16, State 1, Line 10ORDER BY items must appear in the select list if the statement contains a UNION, INTERSECT or EXCEPT operator.---------------------------- MY CODE BELOWDECLARE @CategoryID intDECLARE @ProductID int --SET @ProductID = 4 --SET @CategoryID = (SELECT CategoryID FROM Products WHERE ProductID = @ProductID)SELECT 0 AS 'SizeID', '--> Select Size' AS 'SizeDescription' UNIONSELECT S.SizeID, S.SizeDescription FROM Sizes SINNER JOIN CategorySizes CSON S.SizeID = CS.SizeIDLEFT OUTER JOIN Quantities QON Q.SizeID = S.SizeIDWHERE CS.CategoryID = @CategoryIDAND Q.SizeID is NULLORDER BY S.[Rank] |
|
|
darenkov
Yak Posting Veteran
90 Posts |
Posted - 2007-10-07 : 08:42:57
|
| ok sussed it out.just wrapped the query and gave it an alias then ordered the rank based on the column through the alias |
 |
|
|
Kristen
Test
22859 Posts |
Posted - 2007-10-07 : 13:10:23
|
| Yup, that's most probably the easiest way to do it. Bit of a Pain though ... Ho!Hum! |
 |
|
|
|
|
|