create view v_test as select *,case when [count]>100 then '合格' else '不合格' end as type from tb go
create view v_a as select id,count,case when count >= 100 then '合格' else '不合格' end from A
use [yourdatabase] go -- drop first if object_id('v_test') is not null drop view v_test go -- and then create create view v_test as select *,case when [count]>100 then '合格' else '不合格' end as type from tb go
CREATE VIEW VIEW1 AS select *,case [count]/100 when 0 then '不合格' else '合格' end from a --我自己已经测验过了 可行
as
select *,case when [count]>100 then '合格' else '不合格' end as type
from tb
go
as
select id,count,case when count >= 100 then '合格' else '不合格' end from A
go
-- drop first
if object_id('v_test') is not null
drop view v_test
go
-- and then create
create view v_test
as
select *,case when [count]>100 then '合格' else '不合格' end as type
from tb
go
CREATE VIEW VIEW1
AS
select *,case [count]/100 when 0 then '不合格' else '合格' end from a
--我自己已经测验过了 可行