當前位置:首頁 » 編程語言 » 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 13:36:59 瀏覽:438
三星手機簡訊在那個文件夾 發布:2025-03-17 13:31:51 瀏覽:194
安卓皇帝隱藏劇情在哪裡 發布:2025-03-17 13:18:53 瀏覽:507
新版安卓為什麼不兼容 發布:2025-03-17 13:18:49 瀏覽:483
s3哪個配置性價比高 發布:2025-03-17 13:06:09 瀏覽:320
氣體壓縮能量 發布:2025-03-17 13:00:16 瀏覽:78
壓縮油19 發布:2025-03-17 12:25:29 瀏覽:858
linux上網代理 發布:2025-03-17 12:23:56 瀏覽:361
c是高級語言嗎 發布:2025-03-17 12:16:31 瀏覽:525
python泛型 發布:2025-03-17 12:15:01 瀏覽:484