Monday, March 26, 2012

help on join statement

I have two tables:

tblUserData
UserName
UserCode

tblBlogs
UserCode
BlogText

I have an SP which takes the username as a variable.

How can I select all blogtext from tblBlogs where the usercode belonging to the username in tblUserdata is equal to the usercode in tblBlogs?


so select all blogs for a specfic username...

SELECT TB.* FROM tblBlogs TB

JOIN tblUserData TUD ON TB.Usercode = TUD.UserCode

WHERE TUD.UserName = @.UserName

No comments:

Post a Comment