Subject | do not work view (case) |
---|---|
Author | Maxim Evdokimov |
Post date | 2007-10-20T22:31:20Z |
Hello,
in table "order_" field "GroupCode_" change type of customer (hotel,
restaurant etc). Each customer type have own table with its details.
i created view:
create view v_order_ (code_, ... ObjectName, ... Town, ... ObjectCode, GroupCode_) as
select
o.code_, ...
case o.GroupCode_
when '0' then null
when '1' then h.thename
when '2' then tr.name_
when '3' then g.name_
when '4' then tu.thename
when '5' then r.thename
end, ...
case o.GroupCode_
when '0' then null
when '1' then h.town
when '2' then tr.town
when '3' then g.town
when '4' then tu.town
when '5' then r.town
end, ...
o.ObjectCode,
o.GroupCode_
from order_ o
join hotel h on o.ObjectCode = h.code_
join transport tr on o.ObjectCode = tr.code_
join guide g on o.ObjectCode = g.code_
join turfirm tu on o.ObjectCode = tu.code_
join restaurant r on o.ObjectCode = r.code_;
While every record has GroupCode_ = null - all is ok and view is
working (ObjectName is null).
But when in any record GroupCode_ != null view is showing nothing :(
(in IBExpert it shows one record with all null fields)
--
Best regards,
Maxim mailto:firebird@...
in table "order_" field "GroupCode_" change type of customer (hotel,
restaurant etc). Each customer type have own table with its details.
i created view:
create view v_order_ (code_, ... ObjectName, ... Town, ... ObjectCode, GroupCode_) as
select
o.code_, ...
case o.GroupCode_
when '0' then null
when '1' then h.thename
when '2' then tr.name_
when '3' then g.name_
when '4' then tu.thename
when '5' then r.thename
end, ...
case o.GroupCode_
when '0' then null
when '1' then h.town
when '2' then tr.town
when '3' then g.town
when '4' then tu.town
when '5' then r.town
end, ...
o.ObjectCode,
o.GroupCode_
from order_ o
join hotel h on o.ObjectCode = h.code_
join transport tr on o.ObjectCode = tr.code_
join guide g on o.ObjectCode = g.code_
join turfirm tu on o.ObjectCode = tu.code_
join restaurant r on o.ObjectCode = r.code_;
While every record has GroupCode_ = null - all is ok and view is
working (ObjectName is null).
But when in any record GroupCode_ != null view is showing nothing :(
(in IBExpert it shows one record with all null fields)
--
Best regards,
Maxim mailto:firebird@...