2

この表をもとに

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' がないため、表示されません。

4

1 に答える 1