| Oracle FAQ | Your Portal to the Oracle Knowledge Grid | |
Home -> Community -> Usenet -> c.d.o.server -> Re: Is there an SQL to create a view that will normalize a denoramlized table?
Paul Q wrote:
> create view xxx as
> select id,
> date,
> hour1
> from table
> union
> select id,
> date,
> hour2
> from table
> .
> .
> .
>
What seems to be missing from all the replies so far is how to tell which hour is which in the normalised view. Try the following:
create view myView as
select id,
date,
1 hour,
hour1 reading
from table
date,
2 hour,
hour2 reading
.
.
.
This will allow you to do the following sort of thing (which I suspect is
what you're after):
select reading
from myView
where id = xxxx
and date = dd/mm/yyyy
and hour = nn;
Hope this helps
Iain
![]() |
![]() |