根据这张表
Field1 field2 field3
10 x 10.x.value
10 y 10.x.valua
11 x 11.x.value
11 y 11.x.value
对于每个 Field1(10 和 11)...检查 x 和 y 值(field3)。如果连 1 都失败了,那么 field1 就没有用了
所以我明白了
Field index1 index2
10 10.x.value 10.y.value
11 11.x.value 11.y.value
到目前为止我有这个 sql
select distinct a.id as 'Id Arquivo', b.idIndice, b.valor from tgpwebged.dbo.sistema_Documentos as a
join tgpwebged.dbo.sistema_Indexacao as b on a.id = b.idDocumento
join tgpwebged.dbo.sistema_DocType as c on a.idDocType = c.id
join tgpwebged.dbo.sistema_DocType_Index as d on c.id = d.docTypeId
where d.docTypeId = 40 and (b.idIndice = 11 AND b.valor = '11111111' OR b.idIndice = 12 AND b.valor = '11111' )
编辑:
这是我的结果集
id idIndice valor
13 11 11111111
13 12 11111
14 11 11111111
14 12 11111
16 12 11111
索引 16 没有 idIndice 11 = '11111111' 所以不应该显示