本文介紹了非布爾類型的表達的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!
問題描述
使用此語句:
select * from qvalues where rowid ,name,compound in (
select rowid,name,compound from qvalues where rowid in (select rowid from batchinfo where instrument='tf1')
group by rowid,name,compound
having COUNT(*)>1
)
group by rowid,name,compound
having rid=min(rid)
出現這個錯誤:
消息 4145,級別 15,狀態 1,第 3 行在預期條件的上下文中指定的非布爾類型的表達式,靠近 ','.Msg 156, Level 15, State 1, Line 8關鍵字group"附近的語法不正確.
Msg 4145, Level 15, State 1, Line 3 An expression of non-boolean type specified in a context where a condition is expected, near ','. Msg 156, Level 15, State 1, Line 8 Incorrect syntax near the keyword 'group'.
這個SQL語句有什么問題?我需要在 have min(rid)
表中找到這三個字段的所有出現.
What is wrong with this SQL statement? I need to find all the occurrences of those three fields in the table having min(rid)
.
更新使用此查詢,外部選擇不起作用.我做錯了什么?
Update Using this query, the outer select is not working. What am I doing wrong?
select * from qvalues where rid not in (
select q.rowid, q.name, q.compound, min(q.rid)
from qvalues q
inner join batchinfo b
on q.rowid = b.rowid
and b.instrument = 'tf1'
group by q.rowid, q.name, q.compound
having count(*) > 1)
推薦答案
我認為這與您要實現的目標相同.
I think this is equivalent to what you're trying to achieve.
select min(q.rid)
from qvalues q
inner join batchinfo b
on q.rowid = b.rowid
and b.instrument = 'tf1'
group by q.rowid, q.name, q.compound
having count(*) > 1
這篇關于非布爾類型的表達的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!
【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!