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

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

·Ç³£¸ÐлÁ½Î»¸ßÊÖÖ¸µã¡£¡£

ллл¡£¡£¡£¡£¡£¡£¡£¡£¡£¡£¡£¡£¡£




Ïà¹ØÎÊ´ð£º

ÇóÖúÒ»¾äSQLÓï¾ä

Êý¾ÝÀàÐÍ£º
Code char(6)
CreateTime datetime
Price float

Êý¾ÝÈçÏ£º

Code      CreateTime          Price
031002 2008-10-17 15:00:15 ......

Çósql´¥·¢Æ÷Óï¾ä

users±í
name  companyId  companyName


company±í
companyId  companyName
1          a¹«Ë¾
2          b¹«Ë¾
......

delphiÖÐexcelµ¼Èësql serverµÄÎÊÌâ¡£

'Select * into mytable from OpenDataSource(''Microsoft.JET.OLEDB.4.0'',''Data Source=f:\test.xls;Mode=Read;Extended Properties=Excel 5.0;Persist Security Info=False' ......

SQL ¹ØÁª±í×÷ΪÌõ¼þ²éѰ

ÓÐÁ½Õűí T1, T2

T1:
id, name, T2id £¬discription

T2:
id, subName

ÆäÖÐ T1µÄ T2id ÓëT2µÄ id ¶ÔÓ¦

ÏëÒÔT1µÄ name ºÍ T2µÄ subName Ϊ Ìõ¼þ ²éѰT1µÄ discripton.
Çë¸ßÊÖÖ¸µ ......

ÇóÒ»SQLÓï¾ä¡£Ð»Ð»

id    name    sfz

1    aa    410654198001204562
2    bb    410654198120461287
4    cc    41065419850 ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ