SQL Óï¾ä¡£¡£ Çë½Ì¸ßÊÖ
ÏÈÀ´Ò»¸ö´íÎóÓï¾ä¡£¡£
select * from [aa] where a1 in (select max(a2),a1 from [aa] group by a1 )
ÎÒ´óÌåÒâ˼£¬
¶Áȡһ¸öͳ¼ÆÏµÍ³ÖÐ ²»Öظ´µÄ IP °´ÕÕ ×îºóʱ¼äÅÅÐò£¬²¢ÏÔʾ³öËùÓÐ×ֶΡ£¡£
¸ßÊÖÇë°ï°ï棬£¬ÒªÇóÒ»ÐÐÓï¾äÍê³É¡£¡£
SQL code:
select *
from [aa] t
where not exists(select 1 from [aa] where a1=t.a1 and a2>t.a2)
SQL code:
select * from [aa] a where a2 = (select max(a2) from [aa] where a1=a.a1 )
ÈýÂ¥Õý½â¡£¡£¡£
ÏÂÃæÓï¾äµ÷ÊÔͨ¹ý£º
select * from [aa] where a2 in (select max(a2) from [aa] group by a1)
²éѯ³ö ²»Öظ´µÄa1 °´ÕÕ a2 ×î´óÖµ×ÔÓÉ ASC »ò DESC
·Ç³£¸ÐлÁ½Î»¸ßÊÖÖ¸µã¡£¡£
ллл¡£¡£¡£¡£¡£¡£¡£¡£¡£¡£¡£¡£¡£
Ïà¹ØÎÊ´ð£º
¸÷λ´óÏÀ£¬ÎÒÓÐÒ»¸öxmlÎļþ
XML code:
<?xml version="1.0" encoding="GB2312"?>
<FileId fileid="86">
<ResultSet>
<row id="0">
......
Çë°ïæ¿´¿´ÔõôÓÅ»¯Ò»Ï£¬¸Ã±íÊý¾ÝԼΪ66Íò£¬ÔËÐÐʱ¼äÒª19Ãë,SQLÈçÏ£º
select DATEPART (hh ,Date_time ) as Hours ,
sum(Counts)*100.0/(Select sum(Counts) as total
&nbs ......
ÒªÊäÈëUSE <Êý¾Ý¿âÃû>ʱ£¬ÒªÓõ½SQL±à¼Æ÷£¬µ«²»ÖªµÀÔÚʲôµØ·½£¬¸ßÊÖ°ï°ïæѽ£¡
SQL2005 µã»÷ÓÒÉϽǵÄ--н¨²éѯ(N)
Êó標選擇Òª²é詢µÄ數據庫£¬È»á ......