Click here to Skip to main content
16,016,489 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
SQL
Sqlstr = "select sum(sal_det_amt) as reimbursement from salary_details where sal_det_desc IN ("+
 " select comp_set_desc  from companyinfo where comp_id = " + strCompanyid +
" and comp_set_type = 'Earnings' and comp_set_deleted = 1 and sal_isdeduct = 0 ) "+
" and sal_id IN (select sal_id from salary_master  where sal_deleted = 0 "+
 " and sal_Year = " + lngPreviousYear + " and comp_id = " + strCompanyid +
 " and emp_code = '" + Txt_Employee.Text + "' ";
Posted
Comments
Gihan Liyanage 28-Aug-14 1:14am    
I think you are duplicating the question..
Gihan Liyanage 28-Aug-14 1:15am    
You can edit question, rather than rewriting, Any way I wish you will be answered in this time.

this procedure may u help


SQL
create PROCEDURE [dbo].[Procedurename]
(
    @strCompanyid  varchar(22)
    ,@lngPreviousYear int

    ,@Txt_Employee varchar(22)
)

as
begin


select sum(sal_det_amt) as reimbursement from salary_details where sal_det_desc IN (
  select comp_set_desc  from companyinfo where comp_id =@strCompanyid
 and comp_set_type = 'Earnings' and comp_set_deleted = 1 and sal_isdeduct = 0 )
and sal_id IN (select sal_id from salary_master  where sal_deleted = 0
and sal_Year = @lngPreviousYear and comp_id = @strCompanyid
and emp_code = @Txt_Employee)

 end
 
Share this answer
 
SQL
select sum(sal_det_amt) as reimbursement 
from salary_details 
where sal_det_desc 
IN 
(select comp_set_desc  from companyinfo where comp_id = 1
and comp_set_type = 'Earnings' and comp_set_deleted = 1 and sal_isdeduct = 0 ) 
and sal_id 
IN 
(select sal_id from salary_master  where sal_deleted = 0 
 and sal_Year = 2014 and comp_id = 1
 and emp_code = 'EMPLOYEECODE' )
 
Share this answer
 
Comments
Gihan Liyanage 28-Aug-14 1:21am    
I assumed your company ID = 1, and sal_Year = 2014,use Employee code as you wish, instead of 'EMPLOYEECODE'
Member 10928697 28-Aug-14 1:28am    
In the bove select query is ok but i wantwith out values..only parameters.
Gihan Liyanage 28-Aug-14 2:15am    
Just Give parameters, like @CompanyID...

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900