SELECT.....
(v1.PCG like 'n0%'
or
v1.PCG like 'n1%'
or
v1.PCG like 'n2%'
or
v1.PCG like 'n3%'
or
v1.PCG like 'n4%'
or
v1.PCG like 'n5%'
or v1.PCG='N63Af1')
and v1.PCG not like 'N2D%'
and v1.PCG not like 'N2E%'
and v1.PCG not like 'N2C%'
and v1.PCG not like 'N2F%'
and v1.PCG not like 'N2J%'
and v1.PCG not like 'N2K%'
and v1.PCG not like 'N2U%'
and v1.PCG not like 'N2GC%'
and v1.PCG not like 'N2GD%'
and v1.PCG not like 'N2GH%'
and v1.PCG not like 'N2GJ%'
and v1.PCG not like 'N2GK%'
) as 'Value Of PN Orders',
from........
我已經競爭我的代碼,但我試圖找到一個更有效的方式做到這一點,我看了一下,但無法找到另一種方式......任何建議?試圖尋找替代喜歡而不喜歡(SQL)
一個正則表達式可以使這個更加緊湊,但它不是SQL Server本機。您需要通過[CLR程序集](http://stackoverflow.com/a/13439423/1324345) – alroc