Click here to Skip to main content
15,893,588 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
<pre><pre lang="text"><pre lang="text">
Hello every body i need a logic for Extracting the data based on dates.

Employees enter the data every day,we offer allowances with effective dates, my problem is if we set allowance with effective date for eg:01/09/2013 the allowance should be effective from 01/09/2013.if the employee enters 29th or 30th entry the allowance should come from allowance that we updated before 01/09/2013.if employee enters for 01/09/2013 the allowance should be new.How to work out the logic.pls help me.
Posted

1 solution

SQL
select  
AllownceID, effectiveDate
from tableAllownce 
where effectiveDate <= @Salarydate 
Order by effectiveDate desc

Happy Coding!
:)
 
Share this answer
 
Comments
Member 10229493 26-Aug-13 12:20pm    
Thanks sir..but it is ok for fewer employees.There is a header table and detail table i am having based on max effective date i created the view that show values from detail and header with effective date.From the front end i just pass the employee code (eg)select * from vallowance where empcode=1234 like that..i extract last entry if say the employee enters upto 26/08/2013 i check it and i sets the next date automatically .how to work out the logic..pls help me

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