下面是查询公司的基本信息,是用存储过程好,还是视图好呢?
这一点很迷惑,希望大家多多指教。
select comp_id, comp_name,city_name+coun_name as address ,comp_homepage,comp_email,comp_tel
from tbl_company comp
join
(select city_name,city_id from tbl_city) city
on comp.comp_address_city=city.city_Id
join
(select coun_id,coun_name from tbl_country) coun
on comp.comp_address_county=coun.coun_id
------解决方案--------------------
除非你建索引视图,否则相当于只是保存了一个查询批