getting more rows out of a table
Posted in 2005
Topics: General Discussion
I currently have a table showing data for hotels with fields such as: day_no start_date nights Now, the table does not list every night stayed, just the checkin and number of nights stayed. I need to show every day in a report, and also do some calculations on it. I can get the information on the screen using a FOR statement in the FORMAT section, but then I can't do the calculations. Can I use a FOR statement in SELECT? If so, how. Or if not, got any smart ideas???
gingerafro wrote:
> I currently have a table showing data for hotels with fields such as:
> day_no
> start_date
> nights
>
> Now, the table does not list every night stayed, just the checkin and
> number of nights stayed.
> I need to show every day in a report, and also do some calculations on
> it. I can get the information on the screen using a FOR statement in
> the FORMAT section, but then I can't do the calculations.
>
> Can I use a FOR statement in SELECT? If so, how. Or if not, got any
> smart ideas???
>
No, try something like:
create table days
(
day integer no null
);
insert into days values(0);...
insert into days values(99);
select (a.day_no + b.day) day_no,
(a.start_date + b.day) booked_date
from yourtable a, days b
where b.day < a.nights