易截截图软件、单文件、免安装、纯绿色、仅160KB

求sql文

求A != 1 and B != 2 以外的记录
a!=1 and b!=2 以外?

那岂不是a=1或者b=2的这种情况么

select * from table where a = 1 or b = 2

如果是A != 1 and B != 2的话
select * from table where a <> 1 and b <> 2

where not(A!=1 and B!=2)

引用
如果是A != 1 and B != 2的话
select * from table where a <> 1 and b <> 2


这样子OK!

各位:
  请看好了,是A != 1 同时 B!= 2 以外的情况

A != 1 and B!= 2
它的反义就是:
A = 1 or B = 2

引用
各位:
  请看好了,是A != 1 同时 B!= 2 以外的情况

你的描述存在歧义
如果是“求A != 1” and“ B != 2 以外的记录”
条件就写
where a!=1 and not(b!=2)
当然你也可以写成where a!=1 and b=2
你根据需要修改下

A != 1 同时 B!= 2 以外的情况

情况1:
(A != 1 同时 B!= 2)以外的情况,则
a = 1 or b = 2 or a is null or b is null;

情况2:
A != 1 同时 (B!= 2以外)的情况,则
a != 1 and (b = 2 or b is null);

离散数学书上有。

引用
各位:
  请看好了,是A != 1 同时 B!= 2 以外的情况



相关问答:

sql server 存储过程循环赋值的问题

小弟是个新手 现在有个问题一直不能解决
例如
procedure produce_proc
    @p001 nvarchar(8000),
    @p002 nvarchar(8000),
    @p003 nvarchar(8000),
  & ......

SQL server数据集出错求助

两种错误:
1.如果我这样申明:ResultSet rs;错误提示如下:

An error occurred at line: 51 in the jsp file: /index.jsp
The local variable rs may not have been initialized
48:    ......

sql 问题

PB中开发的。

DateTime startTime=DateTime(em_1.Text)
DateTime endTime=DateTime(em_2.Text)

string sql
sql = dw_1.GetSQLSelect()+"Where (StartTime> '"+startTime+&q ......

sql 问题

DateTime startTime=DateTime(em_1.Text)
DateTime endTime=DateTime(em_2.Text)

string sql
sql = dw_1.GetSQLSelect()+"Where (StartTime> '"+startTime+"') and (EndTime ......

sql 存储过程问题

SQL code:
declare @t varchar(5000)
set @t=''
select @t=@t+',[取消分析-'+quXiaoFenXi+']=sum(case when [quXiaoFenXi]='+quotename([quXiaoFenXi],'''')+' then shangPinZongShu else 0 end)'
from tb_gyyD ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号