日期:2014-05-20 浏览次数:20741 次
SELECT (SELECT COUNT(*) FROM TableName WHERE CODE=a.CODE)AS [COUNT] ,* FROM TableName as a WHERE [ID] = '30BCA6A3-0B18-4224-9248-14E2CD3F20B6'
var query=from a in db.TableName where a.ID=="30BCA6A3-0B18-4224-9248-14E2CD3F20B6" select new { Count=db.TableName.Where(b=>b.CODE==a.CODE).Count(), a };