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 |
|
skhan
Starting Member
1 Post |
Posted - 2008-03-07 : 06:44:50
|
| ALTER PROCEDURE dbo.GetMostRatedRecipe(@CurrentDate datetime)ASSET NOCOUNT ONSELECT *FROM RecipeWHERE TotalRating =(SELECT MAX(TotalRating)FROM Recipe) AND published = 1 AND ReleaseDate <= @CurrentDate AND ExpireDate > @CurrentDateThis doesn't work good when the recipe having max total rating is not published & expired. I guess I need to first filter the recipes which are published & unexpired and then select the recipe having max total rating. But I don't know how to do that. Could anyone of you please help me doing this ? |
|
|
ayamas
Aged Yak Warrior
552 Posts |
|
|
|
|
|