Ò׽ؽØÍ¼Èí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

¼òµ¥sql²éѯ

Ò»¸öÓû§±íUser£¨id,name£©Ò»¸öÎÄÕ±íAtical(id,UserId,content,EntryTime)
²é³öÿ¸öÓû§×îз¢±íµÄһƪÎÄÕ¡£ÔÚÏߵȴýÖС£¡£¡£¡£
SQL code:
select a.*,
b.*
from [User] a,Atical b
where a.id=b.UserId
and not exists(select 1 from Atical where UserId=b.UserId and EntryTime>t.EntryTime)


Â¥ÉϵϹÔÚÂð£¿ÄãµÄ·½·¨Ã²ËƲ»Ðа¡¡£ÕâÑù²é³öµÄÊÇ×îºó·¢±íµÄһƪÎÄÕ°¡¡£ÎÒÒªµÄÊÇÿ¸öÓû§µÄ×îºó·¢±íµÄһƪÎÄÕÂ

SQL code:
--¾ÍÊÇÿ¸öÓÃ戶°¡,UserId²»¾ÍÊÇÓÃ戶麼
select a.*,
b.*
from [User] a,Atical b
where a.id=b.UserId
and not exists(select 1 from Atical where UserId=b.UserId and EntryTime>b.EntryTime)


with cte as(
select
      *,
  row_number() over(partition by a.userid order by EntryTime desc) as rn
from Atical
)

select a.*,b.*
from [User] a,cte b
where a.id=b.UserId and b.rn=1

ÒýÓÃ
Â¥ÉϵϹÔÚÂð£¿ÄãµÄ·½·¨Ã²ËƲ»Ðа¡¡£ÕâÑù²é³öµÄÊÇ×îºó·¢±íµÄһƪÎÄÕ°¡¡£ÎÒÒªµÄÊÇÿ¸öÓû§µÄ×îºó·¢±íµÄһƪÎÄÕÂ


½¨ÒéÂ¥Ö÷²âÊÔһϣ¬²âÊÔ½á¹û¼´ÕæÀí

select userid,name,content,b.id,entrytime
from user a,atical b
where a.id=b.userid and entrytime in (sel


Ïà¹ØÎÊ´ð£º

sqlÓï¾ä¶à±í¶à×ֶβéѯ - MS-SQL Server / »ù´¡Àà

ÎÒÓжà¸ö±íA B C ½á¹¹ÊÇÒ»ÑùµÄ£¬¶¼ÓÐ2¸ö×Ö¶ÎnameºÍcontent,ÎÒÒªËÑË÷ËùÒÔ±íËùÓÐ×Ö¶ÎÖаüº¬¡°Öйú¡±µÄÄÚÈÝ Õâ¸öSQLÓï¾äÔõôд 

ÈçºÎ½«¶à¸ö±íµÄ²éѯ½á¹ûÁ¬³ÉÒ»¸ö±í Õâ¸öSQLÓï¾äÔõôд ±íµÄ½á¹¹ÊÇÒ»ÑùµÄ
ÀýÈç£ ......

sqlת»»ÎÊÌ⣬¼±£¡ - ÉçÇøÖ§³Ö / ¡¶³ÌÐòÔ±¡·ÔÓÖ¾

select convert(varchar(50),cast(convert(numeric(18,2),1275674000000/100000000)as real))+'ÒÚ'
select cast(convert(numeric(18,2),1275674000000/100000000)as real)
ΪʲôÉÏÒ»¸öÓÃvarcharת»»ºó¾ÍÖ»±£ÁôÁËÒ ......

Ò»¸öpl/sqlÎÊÌâ - Oracle / ¿ª·¢

ÎÒÊÇÔÚtoadÖÐÊäÈë϶Îsql
  declare
  TYPE test_rec IS record(
  code varchar(10),
  name varchar(30)
  );
  v_book test_rec;
    ......

ÇëÎÊASPÈçºÎÁ¬½Ó¶à¸öSQL SERVER£¿ - Web ¿ª·¢ / ASP

ÓÐÁ½¸ö»òÒÔÉϵÄÔ¶³ÌÊý¾Ý¿â£¬ÈçºÎÓÃASP¼ì²âÁ¬½ÓËٶȲ¢Á¬½Ó×î¿ìµÄMSSQLÊý¾Ý¿â£¿

ÓÐÕâÑùµÄASPº¯ÊýÂð£¿ÎÒGOOGLEÁËһϣ¬ÕÒ²»µ½¡£

PHP+MYSQLÏÂÓÐÕâÖÖÀý×Ó£º
PHP code:

Example:
$wgDBservers = array(
......

ÈçºÎʹÓÃMySQL - MS-SQL Server / »ù´¡Àà

¸Õ¸Õ½Ó´¥MySQL,²»ÖªµÀ¸ÃÈçºÎÈ¥²é¿´Êý¾Ý£¬²åÈëÊý¾Ý£¬´´½¨Êý¾Ý¿â¡¢±í£¬ÓÃÄÄΪǰ±²ÄÜÖ¸½ÌÒ»¶þ£¿

MySQL 5.1²Î¿¼ÊÖ²á

ÒýÓÃ
ÐÖµÜÄã»á½áÌùÂð£¿
mysql ²Î¿¼ÊÖ²á

baidu

MySQL¹Ù·½Îĵµ http://dev.mysql.com/doc ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ