¹ØÓÚSQLÓï¾ä
½ñÌìдÍøÕ¾µÄʱºòºÜ囧°¡£¬·¢ÏÖ²éÕÒÓû§È¨ÏÞµÄʱºòÎÞÔµÎ޹ʵÄͬһ¸öȨÏÞÖظ´³öÏֺܶà´Î
Ð޸ĺóµÄSQLÓï¾äÈçÏÂ
SELECT
node
.
id
,
node
.
name
,
access
.
role_id
from
think_role_user
AS
user
,
think_access
AS
access
,
think_node
AS
node
WHERE
user
.
user_id
=
5
AND
access
.
role_id
=
user
.
role_id
AND
access
.
level
=
3
AND
access
.
node_id
=
node
.
id
LIMIT
0
,
30
ÆäÖÐNODEÊÇȨÏ޽ڵ㣬ACCESSÊÇȨÏÞºÍÓû§ËùÔÚ×é¶ÔÓ¦µÄ½Úµã£¬USERÊÇÓû§ÓëÆäËùÔÚ×éÖ®¼äµÄ±í£¬ÕâÑùд³öÀ´µÄSQLÓï¾ä¾ÍÄܹ»ÕýÈ·²éѯÁË
ÎÒ·¢ÏÖÎÒ´íÎóµÄµØ·½ÊǶàÒýÈëÁËÁíÒ»¸öÎÞ¹ØµÄ±í£¬¾ÍÊÇ˵fromÀïÃæ¶à³öÀ´ÁíÒ»¸ö±í£¬Ò»¿ªÊ¼ÎÒÒÔΪûÓвî±ð£¬ºóÀ´²Å·¢ÏÖ¶àÒ»¸öÄÇÑùµÄ±í£¬Í¬Ò»¸ö²éѯ½á¹û¾Í»á¶à³öÄǸö±íµÄ½Úµã¸öÊý±¶¡£¡£¡£
¶÷£¬ºÜ¾ÃûÓÐд¹ýSQL£¬½ñÌìËãÊǸ´Ï°ÁËһϡ£ºÜ²»´í~~~~
Ïà¹ØÎĵµ£º
create PROCEDURE pagelist
@tablename nvarchar(50),
@fieldname nvarchar(50)='*',
@pagesize int output,--ÿҳÏÔʾ¼Ç¼ÌõÊý
@currentpage int output,--µÚ¼¸Ò³
@orderid nvarchar(50),--Ö÷¼üÅÅÐò
@sort int,--ÅÅÐò·½Ê½£¬1±íʾÉýÐò£¬0±íʾ½µÐòÅÅÁÐ
......
¹«Ë¾Óиö±¨±íϵͳÏìÓ¦ËٶȲ»ÊǺÜÀíÏ룬µ÷Óŵ÷Á˺ü¸´Î£¬ÓеãЧ¹û£¬µ«²»ÊǺÜÈÃÈËÂúÒâ¡£×î½üÓÖ¿ªÊ¼µ÷ÓÅ£¬ÊÔÁËÊÔsql server 2008µÄ·ÖÇø±í¹¦ÄÜ£¬¿´¿´ÊDz»ÊÇ·ÖÇøÖ®ºóËٶȿÉÒÔ¿ìÒ»µã¡£
ÓÃÁËÒ»¸ö°ÙÍò¼¶Êý¾ÝµÄ»ã×ܱíÀ´×ö·ÖÇø£¬·ÖÇøµÄÏë·¨ÊÇ°´ÔÂÀ´·ÖÇø£¬Ò»¸ö·ÖÇø´æ´¢Ò»¸öÔµÄÊý¾Ý£¬Ò»¸ö·ÖÇøµ ......
ת×Ôhttp://lavasoft.blog.51cto.com/62575/23373
SQLÓïÑÔµÄCASEÓï¾ä±¸Íü
¸ÅÊö£º
SQLÓï¾äÖеÄCASEÓï¾äÓë¸ß¼¶ÓïÑÔÖеÄswitchÓï¾ä£¬ÊDZê×¼SQLµÄÓï·¨£¬ÊÊÓÃÓëÒ»¸öÌõ¼þÅжÏÓжàÖÖÖµµÄÇé¿öÏ·ֱðÖ´Ðв»Í¬µÄ²Ù×÷¡£Áé»îÓ¦ÓÃCASEÓï¾ä¿ÉÒÔʹSQLÓï¾ä±äµÃ¼ò½àÒ׶Á£¬ÏÂÃæÔÚDB2»·¾³ÏÂͨ¹ýÒ»¸ö¼òµ¥µÄ²éѯÀ´Õ¹Ê¾SQL CASEÓ ......
·½°¸1 ÊÊÓÃÓÚoracle9iÒÔÉÏ£¡
select * from
(select row_number() over(order by sendid desc) rn,m.* from xxt_msgreceive m )
where rn <1010 and rn>=1000
·½°¸2
SELECT * from (SELECT A.*, ROWNUM RN from (SELECT * from xxt_msg where sendstatus=1 order by msgid desc) A WHERE ROWNUM < ......