Subject | Re: [ib-support] Please help. View is empty, but the same SELECT works! |
---|---|
Author | Andrew Guts |
Post date | 2002-09-16T12:14:59Z |
Svein Erling Tysvaer wrote:
This is an empty view:
create view vDepResources
(DepID, Descr, TotalIn, TotalOut) as
select d.DepID,
cast(d.Bank||' '||d.AccountNo as varchar(64)) as Descr,
cast(
(select sum(p.total/p.rate) from pays p where p.dstid = d.subjid and
p.depid = d.depid)
as float) as TotalIn,
cast(
(select sum(p.total/p.rate) from pays p where p.srcid = d.subjid and
p.depid = d.depid)
as float) as TotalOut
from DepRights r
inner join departments d on r.DepID = d.DepID
inner join employees e on r.SubjID = e.SubjID and e.Login = USER
;
And this "SELECT" returns data:
create view vDepResources
(DepID, Descr, TotalIn, TotalOut) as
select d.DepID,
cast(d.Bank||' '||d.AccountNo as varchar(64)) as Descr,
cast(
(select sum(p.total/p.rate) from pays p where p.dstid = d.subjid and
p.depid = d.depid)
as float) as TotalIn,
cast(
(select sum(p.total/p.rate) from pays p where p.srcid = d.subjid and
p.depid = d.depid)
as float) as TotalOut
from DepRights r
inner join departments d on r.DepID = d.DepID
inner join employees e on r.SubjID = e.SubjID and e.Login = USER
BTW: last join has no effect on empty view.
>Exactly what is "body of that view" in this particular case?I mean the select part of view definition:
>
This is an empty view:
create view vDepResources
(DepID, Descr, TotalIn, TotalOut) as
select d.DepID,
cast(d.Bank||' '||d.AccountNo as varchar(64)) as Descr,
cast(
(select sum(p.total/p.rate) from pays p where p.dstid = d.subjid and
p.depid = d.depid)
as float) as TotalIn,
cast(
(select sum(p.total/p.rate) from pays p where p.srcid = d.subjid and
p.depid = d.depid)
as float) as TotalOut
from DepRights r
inner join departments d on r.DepID = d.DepID
inner join employees e on r.SubjID = e.SubjID and e.Login = USER
;
And this "SELECT" returns data:
create view vDepResources
(DepID, Descr, TotalIn, TotalOut) as
select d.DepID,
cast(d.Bank||' '||d.AccountNo as varchar(64)) as Descr,
cast(
(select sum(p.total/p.rate) from pays p where p.dstid = d.subjid and
p.depid = d.depid)
as float) as TotalIn,
cast(
(select sum(p.total/p.rate) from pays p where p.srcid = d.subjid and
p.depid = d.depid)
as float) as TotalOut
from DepRights r
inner join departments d on r.DepID = d.DepID
inner join employees e on r.SubjID = e.SubjID and e.Login = USER
BTW: last join has no effect on empty view.