1.随机选择3记录 select top 3 * from tablename newid() 2.随机选记录 select newid(). 3.删除反复记录 1) delete from tablename where id not in (select max(id) from tablename group by col1,col2,...) 2)select distinct * into temp fromtablename delete fromtablename…
LINQ to SQL语句大全 LINQ to SQL语句(1)之Where 适用场景:实现过滤,查询等功能. 说明:与SQL命令中的Where作用相似,都是起到范围限定也就是过滤作用的,而判断条件就是它后面所接的子句.Where操作包括3种形式,分别为简单形式.关系条件形式.First()形式.下面分别用实例举例下: 1.简单形式: 例如:使用where筛选在伦敦的客户 var q = from c in db.Customers where c.City == "London&quo…