一个简单SQL语句,谢谢
SQL code:
我select * from table1
结果:
id name ispass
1 tom n
2 kate y
能不能我select * from table1之后,
结果:
id name ispass
1 tom 否
2 kate 是
谢谢!
那你数据库中的数据写成“是”和“否”
SQL code:
create table #tt
(
[id] int,
[name] varchar(50),
ispass varchar(20)
)
insert into #tt values(1,'tom','n')
insert into #tt values(2,'kate','y')
select [id],[name],case("ispass") when 'n' then '否' when 'y' then '是' end as ispass from #tt
drop table #tt
SQL code:
select id,name,ispass=case ispass when 'n' then '否' when 'y' then '是' end from table1
SQL code:
select name,
case
when ispass='n' then N'否'
when ispass='y' then N'是'
end as ispass
from table1
update xy
set ispass=‘否’
where ispass=‘n’;
update xy
set ispass=‘是’
whereispass=‘y’ ;
1樓的方法不現實, 如果下次改成yes/no呢? 還是調用一個�
相关问答:
小弟是个新手 现在有个问题一直不能解决
例如
procedure produce_proc
@p001 nvarchar(8000),
@p002 nvarchar(8000),
@p003 nvarchar(8000),
& ......
with adod_dict do
begin
close;
commandtext:='select bgqxcode,count(*) wjsl from wscl_wsda_file where wjnd=:tnd group by bgqxcode'; ......
将一个表21~30删除,sql语句怎么写
这个太笼统了,是排序后的第21条到30条记录删除还是某一列值在21到30之间的删除啊?
21-30是什么意思?字段的话就delete from table1 where col1>=21 and col1<=30
指� ......
情况是一张表(T)内,每条记录有一个类型字段,当按类型字段来分类查询并分页处理时
(表T内的类型是指向另一张类型表的一个ID值)
我想到了两种方式;
环境:PHP+MYSQL
1、PHP 先执行一条查询得到 ......