例......
Create Table QryTable (ID [int], Description [nvarchar](255), CSV_Vals [nvarchar](255))
insert into QryTable
values
(1, Description of record #1 , val_1,val_2,val_3,val_4,val_5,val_6 ),
(2, Description of record #2 , val_1,val_3,val_6,val_9,val_10,val_11 ),
(3, Description of record #3 , val_2,val_3,val_4,val_15,val_20,val_21 )
Create Table CriterionTbl (ID [int] identity (1,1), CriterionVals [nvarchar](50))
insert into CriterionTbl values ( val_3 ), ( val_4 )
职能方面类似于:
Select *
from QryTable
where CSV_vals like `AND (SELECT CriterionVals from CriterionTbl)`
调查结果与提出询问的结果相同,但独立价值是质疑危机清单表的结果,只有记录包括危机变数表中所有数值,而不是列入危机变数表中任何数值的记录:
Select *
from QryTable
where CSV_vals like %val_3%
and CSV_vals like %val_4%
我能够利用以下问询,在危机地区获得任何价值的记录,但我需要写一个问询,回答所有标准都来自危机调查局的纪录。
这是我在危机地区记录的任何情况:
select *
from QryTable
Join (select * from CriterionTbl as CT)
on QryTable.CSV_Vals like % + CT.CriterionVals + %
This returns: records 1, 2, and 3, becauuse 1,2, and 3 all have either val_3 or val_4 But what I want is only records 1 and 3, because only 1 and 3 have val_3 and val_4
但是,我需要从次顺序来做到这一点,这样,结果就依据的是危机清单的内容。