If the desired state is null then you won't get any record for the user. Instead of using INNER JOIN, try using a LEFT JOIN:
Select u.displayname, up.*, a.avatarpic, tc.countryname, ts.statename, isnull(tds.statename,0) as desiredstatename, ut.usertype
from (tbl_User u
inner join tbl_userprofile up on u.userid=up.userid
inner join tblCountries tc on tc.countryid = up.country
inner join tblStates ts on ts.stateid = up.state
inner join tbl_userType ut on ut.usertypeID = u.usertypeID
inner join tbl_avatar a on u.avatarid=a.avatarid)
left join tblStates tds on tds.stateid = up.desiredstate
Where u.Userid = @Userid
Main Topics
Browse All Topics





by: wstuphPosted on 2006-04-20 at 10:19:44ID: 16500317
Do you get results if you change it to a left outer join? If you're inner joining and it's not there then it's not going to show up.