当前位置:首页 » 编程语言 » sql非布尔类型的表达式

sql非布尔类型的表达式

发布时间: 2022-06-25 04:32:40

1. sql多字段查询重复数据语句中在应使用条件的上下文(在','附近)中指定了非布尔类型的表达式是怎么解决

你是sqlserver 库吧。sqlserver不支持这种写法,这写法是oracle支持的,sqlserver多字段的in就得使用exists,或者 join 等写法了

select*fromstuda
whereexists(select1from(selectStudentno,SnamefromstudgroupbyStudentno,Snamehavingcount(*)>1)bwherea.Studentno=b.Studentnoanda.Sname=b.Sname)

或者

select*fromstudajoin(selectStudentno,SnamefromstudgroupbyStudentno,Snamehavingcount(*)>1)bona.Studentno=b.Studentnoanda.Sname=b.Sname

有问题追问

2. SQL查询的问题:在应使用条件的上下文(在 ')' 附近)中指定了非布尔类型的表达式。

1 check约束要求括号里面是个bool类型的表达式 把分号去掉
2 各个表建表语句后面的逗号去掉
3 int(20) 不要给int制定列宽
4 后面几个外键建立的时候写法有误

3. 【sql】在应使用条件的上下文中指定了非布尔类型的表达式

left join 的语法是,left join 表名 on 条件
你的sql中,只写出了要关联的表,但是没有on条件啊,在后面把条件加上就可以了。

4. SQL查询问题:在应使用条件的上下文(在 ')' 附近)中指定了非布尔类型的表达式。请问如何解决呢

1、 付款时间=(...)这个就错了,应该是 付款时间 in(...)
2、第一个Where后面应该是条件,条件应该是一个条件表达式,你这样写是错的

5. SQL语句中IN谓词前带两属性提示:括号中在应使用条件的上下文(在 ',' 附近)中指定了非布尔类型的表达式

为什么要这样写呀亲,你不要用IN语句。直接 AND SC.cno in (1,2) 就可以了呀

没有sqlsever的环境 in(a,b)不知道它sql能不能这样写 我试了一下postgresql是可以的。

第三行就只有一个逗号。

6. SQL查询的问题(在应使用条件的上下文(在 ')' 附近)中指定了非布尔类型的表达式。)

1.Having子句后面要跟布尔类型的表达
2.别名branch_avg后的(branch_name,avgbalance)也是多余的。
修改后:
select branch_name,avgbalance
from (select branch_name,avg(balance) as avgbalance
from account_table
group by branch_name)
as branch_avg
group by branch_name
having max(avgbalance) = sum(avgbalance)
也可以这样写:
将平均balance降序排序,第一行就是最大的。
select top 1 branch_name,avgbalance
from (select branch_name,avg(balance) as avgbalance
from account_table
group by branch_name)
as branch_avg
order by avgbalance desc

7. SQL遇到的问题!消息 4145,级别 15,状态 1 出现了错误:非布尔类型表达式是什么啊求助~~~~

Create rule sex_rule as @sex='男' or @sex='女'
go
exec sp_bindrule 'sex_rule','person.sex'

8. SQL中显示在使用条件的上下文中指定了非布尔类型的表达式是什么意思(显示第三行有语法错误)

1.Having子句后面要跟布尔类型的表达 2.别名branch_avg后的(branch_name,avgbalance)也是多余的。修改后: select branch_name,avgbalance from (select branch_name,avg(balance) as avgbalance from account_table group by branch_name) as branch_avg group by branch_name having max(avgbalance) = sum(avgbalance) 也可以这样写:将平均balance降序排序,第一行就是最大的。 select top 1 branch_name,avgbalance from (select branch_name,avg(balance) as avgbalance from account_table group by branch_name) as branch_avg order by avgbalance desc

9. sql中在应使用条件的上下文(在 ',' 附近)中指定了非布尔类型的表达式问题

select t2.customer_name
from customer t1 left join customer t2 on t1.city=t2.city and t1.street=t2.street
where t1.customer_name='smith'

10. SQL编程问题 在应使用条件的上下文(在 'iCurrentStrength' 附近)中指定了非布尔类型的表达式。

where子句,必须是一个布尔判断表达式,iBudgetedStrength - iCurrentStrength不符合规则。
select count(*)
from Position
where iBudgetedStrength = iCurrentStrength 改成“=”

热点内容
linux反编译jar 发布:2025-02-05 10:46:29 浏览:25
算法激励 发布:2025-02-05 10:45:48 浏览:304
java16进制字符串 发布:2025-02-05 10:38:13 浏览:643
创业团队配置有哪些 发布:2025-02-05 10:37:40 浏览:630
王者键盘怎么设置安卓 发布:2025-02-05 10:32:01 浏览:373
阿里云轻量服务器ip搭建 发布:2025-02-05 10:24:46 浏览:487
编程高精度 发布:2025-02-05 10:22:28 浏览:230
使命召唤如何配置爆炸狙 发布:2025-02-05 10:08:12 浏览:143
java访问共享目录 发布:2025-02-05 10:03:56 浏览:282
行车记录仪存储卡多大合适 发布:2025-02-05 09:35:21 浏览:112