Click here to Skip to main content
15,890,506 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I need to populate a dropdown list with a date range as follows:
1/3/2009-1/9/2009, 1/10/2009-1/16/2009 etc i.e Saturday-following friday. There is already a table containing these dates and i use following query to fill the dropdown.
SQL
SELECT "CCSP_PAYROLL_DATE_CD"."PAY_BEG_DTM"||' - '||
           "CCSP_PAYROLL_DATE_CD"."PAY_END_DTM"  as DT_RANGE
  FROM "CCSP_PAYROLL_DATE_CD"
  WHERE ("CCSP_PAYROLL_DATE_CD"."DELETE_DTS" is null ) AND
           ("CCSP_PAYROLL_DATE_CD"."EXP_DTM" is null OR
           "CCSP_PAYROLL_DATE_CD"."EXP_DTM" >= sysdate)
  ORDER BY "CCSP_PAYROLL_DATE_CD"."PAY_BEG_DTM" DESC,
           "CCSP_PAYROLL_DATE_CD"."PAY_END_DTM" DESC;

In this query i should also be able to put a condition to populate date ranges only until 60 days back from the system date's pay beginning date.
For example if today's date is taken(11/29/2012), then the pay begeinning date would be (11/24/2012).So the dropdown list should show only 60 days back from 11/24/2012.

Is it wise to put this condition in the stored procedure or in the code.Which is more effiecient as it is a web application.
Posted

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