Fetched Combined Data from Two Tables in SQL Server

Last Reply on Dec 20, 2012 04:33 AM By vinayak

Posted on Dec 20, 2012 12:33 AM

hi friends,i want to compare two tables and display the records in gridview.i know how to compare the two tables using join,but my problem is,,in one web page(employeerecords.aspx) i have a gridview control in that gridview controls i fill the data like empcode,empname,desig,dept,status and salary slip ,in the salary slip i provide a link button generate salary slip,this details saved in table 1,when i click the link button generate salary slip i pass the emp id like this

 PostBackUrl='<%# "payslip1.aspx?empid=" + Eval("empid").tostring() %>' Text="Generate Payslip"></asp:LinkButton>

and it will pass to the payslip1.aspx and display the requird records,and in the payslip1 that means 2nd webpage i want to enter leave details,deductions and others and i saved to the table2 ,in the table2 i provide a field like status whether the salary is generated or not,once it done i will get back to 1st webpage (employeerecords.aspx)i want to fill the status column ,status column is stored in 2nd table,actually i filled the gridview with table1 records,,how to retrive the table2 status column in the gridview..how to write the condition for this...can anyone help me

Posted on Dec 20, 2012 04:33 AM

then your query must be like,


select c.empid
from emppersonal c
inner join  payslip op on c.empid = op.empid