table是表名
里面有
id conditionPary_id condition_id
1 0 1
2 1 1
3 2 3
4 5 5
找出这个表里的 conditionPary_id condition_id
这两个字段记录不同的数据来
要结果是
id conditionPary_id condition_id
1 0 1
3 2 3
里面有
id conditionPary_id condition_id
1 0 1
2 1 1
3 2 3
4 5 5
找出这个表里的 conditionPary_id condition_id
这两个字段记录不同的数据来
要结果是
id conditionPary_id condition_id
1 0 1
3 2 3
解决方案 »
- 网站中sql server 2000 的一个字段等于另外一个字段+100的问题
- 求一sql语句
- 得不到数据库返回的错误???
- 数据库还原问题
- 安装SQL Server2000 出现问题:未找到提供程序,该程序可能未正确安装。
- 請問:Sql Server 2000 有沒有一些特定的存儲過程,可以用來檢測1台特定的Sql Server 2000, 看看它是否崩潰了的?謝謝
- 诚心求教
- 主键的功能对使用者来说只是限制重复记录吗?
- 关于触发器的问题(SQL SERVER 2000)
- 关于存储过程的问题!大家一起来讨论!在线等!大家来啊!
- 这个存储过程写的对不对啊?请高手指点!
- 游标值能不能通过执行一个字符串传入
里面有
id conditionPary_id condition_id
1 0 1
2 1 1
3 2 3
4 5 5
找出这个表里的 conditionPary_id condition_id
这两个字段记录不同的数据来
要结果是
id conditionPary_id condition_id
1 0 1
3 2 3 select * from tb where conditionPary_id <> condition_id
where conditionPary_id<>condition_id
insert into @tb select 1,0,1
insert into @tb select 2,1,1
insert into @tb select 3,2,3
insert into @tb select 4,5,5select * from @tb t
where conditionPary_id<>condition_idselect * from @tb t
where conditionPary_id<>condition_id
如果有空字段可以这样用isnull这个函数
declare @tb table (id int,conditionPary_id int,condition_id int)
insert into @tb select 1,0,1
insert into @tb select 2,1,1
insert into @tb select 3,2,3
insert into @tb select 4,5,5select * from @tb t
where isnull(conditionPary_id,0)<>isnull(condition_id,0)
where conditionPary_id!=condition_id