1

Background
Im trying to create a report via ingres where i provide 2 dates ($begin_date and $end_date)
this report will provide me with errors from a system that occured between the two dates.
If these dates are less than one day apart, I should have a more detailed report.

Question
Is there any way to have more than one select in this report dependent on the difference between the dates?
like:

$end_date - $begin_date = difference
.QUERY

if difference < 1 day
    select col1, col2, count(*) as number from table
    group by col1, col2
else
    select col1, count(*) as number from table
    group by col1

Or instead have a if statement inside the SELECT, im not an experienced sql user so not sure about that last one, if its even possible.

Any help would be awesome, or any pointers what I should search for.

Emil Nolin
  • 72
  • 8

1 Answers1

1

Create a proc, and use $begin_date & @end_date parameters.

Add your logic in proc, and output is dynamic table structure.

You should allow the object to automatically adapt to the structure in the program.

hpyhacking
  • 285
  • 3
  • 14
  • Decided to create two report files (.rw) one for each scenario and use the proc (.com) to decide which report to use, thanks Jack for bumping me in the right direction. – Emil Nolin Dec 09 '10 at 08:14