0

我有以下 sql 查询表现不佳:

SELECT 
    Count(ExtCardID) as CardCount 
from 
    CardIDs CARDS with (NoLock)
inner join 
    (select CustomerPK 
     from GroupMembership with (NoLock)
     where CustomerGroupID = 14 and Deleted = 0) as GM on GM.CustomerPK = CARDS.CustomerPK

上述连接中的以下Select部分返回了 800 万条记录:

select 
    CustomerPK from GroupMembership with (NoLock)
where 
    CustomerGroupID = 14 and Deleted = 0

有没有更好的方法来编写上面的sql代码?请指教。

4

1 回答 1

0

您是否尝试过使用 LINQ?

LINQ 相当不错,而不是直接查询!

好文章

于 2013-05-20T15:12:12.317 回答