常用的SQL语句两个

 

1、查询一表中的10-15的记录

select top 6  * from (select top 15 * from Users order by UserID ASC) order BY UserID DESC

 2、查询10-15之间的记录(注意ID不连续)

select top3 * from 表 where id not in (select top5 id from 表 )

 3、使用A、B表造C表

看图:

A表结构:

 

 

B表:

C表:

 

 

用到的SQL语句:


ALTER VIEW View_Users
as
select b.BID,UserName,Btitle,b.UserID,Btime  from Users a,Books b where a.UserID=b.UserID

 

posted @ 2012-04-23 16:05  a鼎盛科技  阅读(106)  评论(0编辑  收藏  举报