select distinct name from t a
where not exists(select * from t where name=a.name and tp<>a.tp and tp<>'f')
where not exists(select * from t where name=a.name and tp<>a.tp and tp<>'f')
解决方案 »
- 一个字段判断其值再输出的问题
- 急:如何显示一个表中的一部分记录和另一部分记录的内容
- 请叫前辈们如何制作一个SQLServer服务启动批处理文件
- SQLyog Enterprise强制Copy表结构给本身数据库,数据会丢吗,急
- 有个数据库性能方案问题需要确认,急,高手救命!
- 急啊,如何将ntext字段类型改为nvarchar(1000)的字段类型
- 八水绕长安,大哥,你写的语句运行出了点问题呀!谢谢!!!
- 急!怎样使用sqlservser查询远程vfp数据库
- 请教ASP连接数据库问题
- 询问:为了避免无用数据,这样的系统在设计有没有什么好方法?
- 用jdbc连接数据库的问题
- ■■■ 送分来了:简单的sql查询语句......
更新放在一起不好处理,可以另外写个语句更新就可以了呀。select name count(distinct tp) from table
where tp<>'f' group by name having count(distinct tp)=1
(select tp from table where name='4' and tp<>'f') table1 where table.name='4' and table.tp='f'