开发者

More than one SELECT in ingres report writer

开发者 https://www.devze.com 2023-01-29 09:29 出处:网络
Background Im trying to create a report via ingres where i provide 2 dates ($begin_date and $end_date)

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, co开发者_高级运维l2, 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.


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消