当前位置:首页 » 编程语言 » 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 改成“=”

热点内容
安卓苹果通讯录怎么同步 发布:2025-03-17 09:58:12 浏览:172
ai缓存 发布:2025-03-17 09:48:27 浏览:920
翘嘴水滴轮什么配置 发布:2025-03-17 09:47:34 浏览:582
小蚁摄像机如何云存储 发布:2025-03-17 09:42:42 浏览:817
如何修改自己的名字和密码 发布:2025-03-17 09:32:20 浏览:787
宝马3系枪灰色轮毂是哪个配置 发布:2025-03-17 09:28:17 浏览:514
鸿蒙系统退回安卓系统怎么备份 发布:2025-03-17 09:14:33 浏览:614
数据库服务公司 发布:2025-03-17 08:56:43 浏览:496
我的世界服务器加载不了区块 发布:2025-03-17 08:56:39 浏览:818
如何给无线路由器设置密码 发布:2025-03-17 08:51:40 浏览:886