eswar rao

eswar rao

  • 1.6k
  • 98
  • 19.4k

how to get the single user post data from two table in asp.n

Nov 29 2015 1:20 AM
how to get the single user post data from two table in asp.net using c# with sql query. 
 
dear sir ,i have a one problem regarding get the data from database of single user data from two tables using asp.net ..
i have two tables that table2 is user post data and table2 contain images paths of table one post data,i want whos post the data from two tables ..i mean if i post the data i want display only my posts where postby=eswar..
i hope you understand my problem ..(i got the data but another persons posted data also )by using below query ...please write a right query to get the perfect data..
THankyou
my query is:
SELECT n.newsid, n.state, n.district, n.region, n.views, n.currentplace, n.newstitle,
n.description, n.poston, n.postby, (SELECT TOP 1 imagepath FROM tbl_userpost_newsimages ni WHERE nipostby='"+lbl_upname.Text+"' and n.newsid=ni.newsid) AS imagepath
FROM tbl_userpost_news n Order By n.poston desc

Answers (3)