幾條簡單而且實用的SQL語言:
1. 選出每X-Y條記錄(按某個條件排序)
select top (y-x) * from (select top y * from table order by id) a order by id desc
2. 先出符合打件的記錄數
select conunt(*) from table where
3. 選取最大ID號
select max(ID) from table
select top 1 id from table order by id desc
4. 按字段1統計字段2
select count(字段2) from table group by 字段1
select sum(字段2) from table group by 字段1
5. 選取不重復記錄
select distinct 字段 from table