在線求助﹗﹗﹗
Stutents表的結構如下﹕
ID BOY GRIL
A001 YES NULL
A002 NULL YES
.
.
.
.
.
.
.
.
.要求用select into 從Stutents 抽取數據 到表 Stu
Stu字段為ID,SEX 其中 SEX 依據Stutents表中的字段BOY﹐
GRIL 如果BOY為 NULL﹐SEX 就為GRIL﹐如果GRIL為 NULL﹐SEX 就為BOY
Stutents表的結構如下﹕
ID BOY GRIL
A001 YES NULL
A002 NULL YES
.
.
.
.
.
.
.
.
.要求用select into 從Stutents 抽取數據 到表 Stu
Stu字段為ID,SEX 其中 SEX 依據Stutents表中的字段BOY﹐
GRIL 如果BOY為 NULL﹐SEX 就為GRIL﹐如果GRIL為 NULL﹐SEX 就為BOY
2006-09-01 22:35
select id,case when not(boy is null) then 'boy' else
case when not(gril is null) then 'gril' else '未知' end
end as sex into Stu from stutents

2006-09-02 10:36
2006-09-04 17:15