I have two tables in my database named…Requests and Balance tracker which has no relation….but i want to select data from two tables and binf it two grid…
Requests
EmpID |EmpRqsts|EmpDescription|ApproverID
1 |asdfsb |sadbfsbdf |1
2 |asbfd |sjkfbsd |1
Balance Tracker
EmpId|BalanceAmnt|LastUpdated
| 1 |5000 |sdfbk
| 2 |3000 |sjbfsh
Employee Table
EmpId|EmpName
1 |Anil
2 |Raghu
Now Balance tracker has ForeignKey column of EmployeeTable…What i want is..iwant to select [EmpName ] from EmpTable [EmpRqsts] from [Requests] and [BalanceAmnt][LastUpdated] from [Balance Tracker] and bind it to grid
This is my stored procedure I am using to retrieve the data
create procedure SP_GetEmployeeRequests
(@ApproverName varchar (50))
as
begin
select
EmployeeDetails.Emp_Username,
RequestDetails.Request_Amount,
RequestDetails.Request_description,
BalanceTracker.Balance_Amount,
BalanceTracker.LastApproval,
BalanceTracker.LastUdated
from
EmployeeDetails, RequestDetails, BalanceTracker
where
EmployeeDetails.Emp_ID = RequestDetails.Emp_ID
and BalanceTracker.Emp_ID = RequestDetails.Emp_ID
and RequestDetails.Approved_ID = (select Approved_ID
from ApprovalDetails
where Approved_By = @ApproverName)
end
Everything is fine till here but this query is retrieving only the column names. But not the values of the tables..can any one help me whats wrong in my query..
Try the following: