我有Table Book,数据是:
BookID Name Type
------ ------ -----
1 A null
2 B null
如何从表格View中创建一个视图名称[BookList],如下所示:
Name Type
---- ----
A Thin
B Thick
答案 0 :(得分:2)
将视图BookList创建为
select name,
type = case when name = 'A' then 'thin'
when name = 'B' then 'thick'
end
from book