首页 > 解决方案 > 如何在 SQL 中针对列表进行许多 OR 匹配?

问题描述

如何解决第一个逗号?存在语法错误。

if (@BAAgtNo = '0000ZV') and
   (@ProfileNumber = '902876'***,*** '903673', '903674', '903675', '903676', '903677', '903678', '903679')    -- If the booking agent result is 0 then..
begin

标签: sqlsql-serversyntaxsyntax-error

解决方案


我想你想要IN

if @BAAgtNo = '0000ZV' and
   @ProfileNumber in ('902876', '903673', '903674', '903675', '903676', '903677', '903678', '903679')    -- If the booking agent result is 0 then..
begin

推荐阅读