2010-10-12 3 views
0
SELECT COUNT(*) 
FROM dbo.Table WITH (NOLOCK) 
WHERE 
Columnn1 IN (1,2) AND 
Column2 IN 
    (SELECT id FROM dbo.Table2 WHERE id2 = 5 AND id3 = 1) AND 
id4 = 8 
+0

On dirait que vous avez besoin d'une jointure ... dites-nous exactement ce que vous voulez? Et épeler correctement. –

Répondre

0
Context.Table.Count<TableObject>(t => t.id4 == 8 && 
             (t.Column1 == 1 || t.Column1 == 2) && 
             Context.Table2.Count<Table2Object>(t2 => t2.id2 == 5 && t2.id3 == 1 && t2.id == t.id) > 0); 

TableObject et Table2Object sont tout ce que vous les entités à venir nommé du tableau et Table2, respectivement.