Çë½Ì¸öSQL²éѯÎÊÌâ - Oracle / ¿ª·¢
ÎÒÏÖÔÚÓÐÒ»Õűí ÀïÃæÓÐÁ½Ìõ¼Ç¼
name time
ÕÅ 3
Íõ 2
ÏÖÔÚÎÒÏëÒªµÃµ½µÄ½á¹ûÊÇtimeÊǼ¸¾Í»á²éѯ³ö¼¸Ìõ
name time
ÕÅ 1
ÕÅ 1
ÕÅ 1
Íõ 1
Íõ 1
Ôõô×ö
-- ÕâÑùÕû£ºÓÐÒâÒåÂð£¿
µ±È»ÓÐÒâÒåÁË£¬ÎÒÄõıíÖ»²»¹ýÊǾٸöÀý×Ó£¬Êµ¼ÊÓô¦µ±È»ÓÐÁË¡£ÎÒÔÚÕâÀïÖ»²»¹ýÊÇ°ÑÀý×ÓÃèÊöµÄ¼ò»¯ÁË¡£
ºóÃæµÄtime×ֶνá¹ûÊǼ¸¶¼²»Ëùν£¬²»ÊÇ1Ò²ÐУ¬
ÕÅ 3
Íõ 2
ÏÖÔÚÎÒÏëÒªµÃµ½µÄ½á¹ûÊÇtimeÊǼ¸¾Í»á²éѯ³ö¼¸Ìõ
name time
ÕÅ 3
ÕÅ 3
ÕÅ 3
Íõ 2
Íõ 2
ÕâÑù¿ÉÄÜ»á¼òµ¥µã£¬Çë½Ì¸ßÊÖÀ´°ï°ïæ°¡
4Â¥£¬5Â¥µÄ·¢·¨¶¼¿ÉÒÔ£¬µ«ÊÇÎÒÕâ²éѯ½á¹ûÓÐ5000Ìõ×óÓÒ£¬Ö´ÐÐÁË20·ÖÖÓ»¹Ã»²é³öÀ´¡£¡£
¸Õ¸ÕÄǸöSQLµÄЧÂʵÄÈ·²»ºÃ£¬ÊÔÏÂÕâ¸ö
SQL code:
select a.name, a.time
from tb a,
(SELECT level l
from (select max(time) maxtime from tb)
CONNECT BY level <= maxtime) b
where a.time >= b.l
order by a.name
Ïà¹ØÎÊ´ð£º
ÎÒÊÇÓÃÔ¶³Ì×ÀÃæÁ¬²Ù×÷·þÎñÆ÷ÉϵÄÊý¾Ý¿â¡£
ÔÚ´´½¨Ò»¸öÓû§Ö®ºó£¬ÔÙÓÃPLSQLµÇ¼£¬ÔòPLSQLËÀµôÁË¡£
ÎҹصôPLSQLÖ®ºó£¬ÓÃÆäËûÓû§Ò²²»ÄܵǼ¡£
ÎÒ°ÑoracleµÄ·þÎñÍ£Ö¹£¬½á¹û¾ÍÊÇoracleµÄ·þÎñ״̬¾ÍÍ£ÁôÔÚ¡°Í ......
tab1 ×Ö¶Î:billdate,goodsid,incount,inmoney,outcount,outmoney,endprice,endcount,endamt
tab2 ×Ö¶Î:goodsid,goodskind£¨ÉÌÆ·ÀàÐÍ£©
tab3 ×Ö¶Î:goodskind£¨ÉÌÆ·ÀàÐÍ£©,kindname
½á¹û£º
µÃµ½ÉÌÆ·ÀàÐÍÔÚÒ»¶Îʱ¼ä ......
ÎҵĴ¦ÀíÊÇÕâÑùµÄ£º
ÎÒÓÐÒ»¸öºÜ´óµÄÊý¾Ý¼¯ºÏ£¬´¦ÓÚÐÔÄÜ·½ÃæµÄ¿¼ÂÇÐèҪʹÓÃÁÙʱ±í¹ý¶É£¬²¢ÇÒʹÓ÷ÖÒ³µÄ·½Ê½ÏòÁÙʱ±íÖвåÈëÊý¾Ý£¬Êý¾ÝʹÓÃÍê±Ïºó£¬É¾³ýÁÙʱ±íµÄÊý¾Ý¡£
³öÏÖµÄÏÖÏ󣺵±OracleÖØÐÂÆô¶¯ºó£¬µÚÒ»Ò³²åÈëµÄ ......
ллÌÆÈËÀÏ´óµÄÖ¸µã£¬Ð»Ð»¸÷λ¸ßÊÖµÄÖ¸µã£¡
°²×°10g Enterprise¡£ÉÏÍøÏÂÁËMLDNµÄOracleÊÓƵ£¬¸ú×ÅÊÓƵÉϵÄÅäÖÃ×ߣ¬°²×°³É¹¦ÁË£¬µ«ÊÇûÍêÕûµØÅäÖá£
µã»÷½øÈ룺Database Configuration Assistant
1. ´´½¨Êý¾Ý¿â£»
......
ÔÚAccessµÄ²éѯÖÐÖ´ÐÐÏÂÃæµÄÓï¾ä,ÎÞЧ,ÌáʾÆÚ´ýselect ,updata ,...
CreateTble C=Answer N="»ØÌû±í"
(
C=ID T="INTEGER" P=No M=No N="񅧏" Z=false,
C=Ques ......