I'm using Firebird 2.5 or 3.0. I have a query that unions the same fields from two identical subqueries. I want to add a fixed value to a column of the second subquery so that the values of that subquery are guaranteed different from the same column values of the first subquery:
select Q1.* from (select VDATE, VTIME, STAT, PRICURR, SECCURR from "DevHistory"
where DEVID = :ID and VDATE = :DAY1 order by VDATE, VTIME) Q1
union all
select Q2.* from (select VDATE, VTIME + 1440, STAT, PRICURR, SECCURR from "DevHistory"
where DEVID = :ID and VDATE = :DAY2 order by VDATE, VTIME) Q2;
VDATE is an integer julian date, VTIME is an integer number of minutes since midnight, and the :DAY1
and :DAY2
params are always 2 sequential day numbers, hence the 1440 constant for the second subquery.
The VTIME + 1440
syntax doesn't work, of course, but it's what I would like to accomplish. Is there a way to do this in the query? Or do I have to massage the data after retrieval?