原文:SQL点滴29-错误无处不在 我只想说以下是很基础的sql知识,但是很容易犯错.所以睁大我们的眼睛,屏住我们的呼吸,小心的检查吧! 案例1if not exists (select OrderID from CorpEmailSendQueue where orderid=600643425) begin exec sp3_CorpEmailSendQueue_i @ID=NULL,@OrderID=600643425, @OrderType='F', @EmailType='-2
一.sql语句执行顺序 from join on where group by avg,sum,count等各种函数 having select distinct order by(asc(升序),desc(降序)) limit 二.如何获取表记录,或者某字段不同值个数 select count(distinct a.user_id) as cnt from table a 三.如何在sql表(假设为表a)中删除重复行 方法1: stp1:筛选出不重复的表记录 select distinct a