SELECT Name, ( NOT (ID_ListGroupParIzm IN (SELECT ID_Param FROM TbUserParam WHERE ID_User=:ID_User ) ) ) Visi FROM CfgListParIzm WHERE ID_ListGroupParIzm=:ID_ListGroupParIzm
错误:
Message 156, Level 15, State 1, Line 1 Incorrect syntax near the keyword "NOT". Message 102, Level 15, State 1, Line 2 Incorrect syntax near the construction ":".
补充:我会尽力解释我想要什么。
我需要一个表中的名称,并且如果ID_ListGroupParIzm IN(从TbUserParam中选择ID_Param,在其中ID_User =:ID_User,请选择ID_Param),则每个节点的BOOL值将为false
和ID_ListGroupParIzm(来自CfgListParIzm)= ID_Param(来自TbUserParam)忘了说:(
顺便说一句:看起来select不能返回逻辑值。。。然后如何达到我的目的:(
添加了一个尝试:
SELECT Name, COALESCE( ( SELECT TOP 1 0 FROM TbUserParam WHERE TbUserParam.ID_User = :ID_User AND TbUserParam.ID_Param = CfgListParIzm.ID_ListParIzm ), 1) Visi FROM CfgListParIzm WHERE CfgListParIzm.ID_ListGroupParIzm = :ID_ListGroupParIzm
错误:消息102,级别15,状态1,行6构造“:”附近的语法不正确。
但是…确定> _ <我需要将其重新制作为程序,谢谢。
SELECT Name, COALESCE( ( SELECT TOP 1 0 FROM TbUserParam WHERE ID_User = :ID_User AND ID_ListGroupParIzm = :ID_ListGroupParIzm ), 1) Visi FROM CfgListParIzm WHERE ID_ListGroupParIzm = :ID_ListGroupParIzm