PL/SQL Question *HELP*!

Spooner

Lifer
Jan 16, 2000
12,025
1
76
If you have a bunch of payroll dates, and you're trying to pull information on certain days (typically twice a month)

We want the run_date to pull the next payroll date that is set up

so in words, it would be something like

select payroll_date
from payroll_table
where payroll_date > run_date < the next payroll date


this make any sense?
 

Cerebus451

Golden Member
Nov 30, 2000
1,425
0
76
SELECT MIN(payroll_date)
FROM payroll_date
WHERE payroll_date > run_date

That gets you the next payroll_date after the run_date. Not sure if that is what you are looking for.
 

Spooner

Lifer
Jan 16, 2000
12,025
1
76
Originally posted by: Cerebus451
SELECT MIN(payroll_date)
FROM payroll_date
WHERE payroll_date > run_date

That gets you the next payroll_date after the run_date. Not sure if that is what you are looking for.

that looks like it may do it.

seems a lot simpler than i thought it would be

thanks dude!
 

Cerebus451

Golden Member
Nov 30, 2000
1,425
0
76
Originally posted by: Spooner


that looks like it may do it.

seems a lot simpler than i thought it would be

thanks dude!
Glad I could help. Hopefully that will do what you need. If run_date is a payroll_date, this query will get the next one. If you want it to return run_date if run_date is a payroll_date, change the '<' to a '<=' and rock and roll.
 

Spooner

Lifer
Jan 16, 2000
12,025
1
76
Originally posted by: Cerebus451
Originally posted by: Spooner


that looks like it may do it.

seems a lot simpler than i thought it would be

thanks dude!
Glad I could help. Hopefully that will do what you need. If run_date is a payroll_date, this query will get the next one. If you want it to return run_date if run_date is a payroll_date, change the '<' to a '<=' and rock and roll.
No, run_date is an arbitrary date whenever they're going to run the extract script.

The next question is, if they run the extract late and it is after the desired payroll_date, i have to build in some exception to make it MAX(payroll_date) where payroll_date < run_date



:eek: