|
johnstern
Yak Posting Veteran
67 Posts |
Posted - 2007-06-29 : 17:30:49
|
| I am not sure if is posible to visualize what is going on here but if you can, I have this SP, and i am thinking my where clause is not well put, I get my results but the where clause looks like could be better express SELECT mu.UserID, UserName, EmailAddress, State, isnull(dm.MemberID,'-1') AS MemberID, isnull(Name,'') AS CustomName, isnull(dm.Title,'') AS Title, isnull(dm.ImageID, '') AS ImageID, isnull(ShowName,'0') AS ShowName, isnull(ShowTitle,'0') AS ShowTitle, isnull(ShowLocation,'0') AS ShowLocation, isnull(ShowPicture,'0') AS ShowPicture, isnull(ShowTotalPosts,'0') AS ShowTotalPosts, isnull(ShowEmailLink,'0') AS ShowEmailLink, isnull(Notify,'0') AS Notify, ImagePath, (Select Count(messageID) FROM Discussion_message dm1 WHERE dm1.UserID = mu.UserID AND Active = 1) As AuthorNumberOfPosts, MessageID, ParentMessageID, Topic, PostDate, messageFROM Membership_User mu join Membership_UserAddress mua ON mu.UserID = mua.UserID left join Discussion_Member dm ON mu.UserID = dm.UserID left join Discussion_Member_Options dmo ON dm.MemberID = dmo.MemberID left join Discussion_Image di ON dm.ImageID = di.ImageIDjoin Discussion_message dmsg ON mu.UserID = dmsg.UserID AND dmsg.Active = 1 WHERE MessageID = @ThreadID OR ParentMessageID = @threadID AND mu.UserID in ( SELECT distinct UserID FROM Discussion_message WHERE MessageID = @threadID OR ParentMessageID = @threadID AND Active = 1) |
|