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

ÇóSqlÓï¾äÒ»Ìõ£¿

±í½á¹¹ÈçÏ£º
ID  ÐÕÃû  ʱ¼ä
1  a      2010-01-01
1  b      2010-01-02
2  c      2010-01-03
2  d      2010-01-01
3  a      2010-01-01
4  b      2010-01-02

ÏÖÔÚÎÒÏ£Íû°Ñ ûÓÐÖØ¸´µÄÊý¾Ý¶¼µÃµ½£¬È»ºó°ÑÓÐÖØ¸´µÄÊý¾Ý£¨IDΪ1ºÍ2£©ÎÒֻҪʱ¼ä×îÍíµÄÄÇÌõ...
лл ¸ßÈ˰ïæ½â´ð£¡£¡£¡
ÓÃdistinctÈ¥ÖØ¸´£¬È»ºówhereÒ»¸öÌõ¼þ£¨Ò²¾ÍÊÇÄãÒªµÄ×î´óʱ¼ä£©

SQL code:
--> ²âÊÔÊý¾Ý£º@tb
declare @tb table([ID] int,[ÐÕÃû] varchar(1),[ʱ¼ä] datetime)
insert @tb
select 1,'a','2010-01-01' union all
select 1,'b','2010-01-02' union all
select 2,'c','2010-01-03' union all
select 2,'d','2010-01-01' union all
select 3,'a','2010-01-01' union all
select 4,'b','2010-01-02'

select * from @tb a where not exists (select 1 from @tb where [ÐÕÃû]=a.[ÐÕÃû] and id>a.id)
/*
ID ÐÕÃû ʱ¼ä
----------- ---- -----------------------
2 c 2010-01-03 00:00:00.000
2 d 2010-01-01 00:00:00.000
3 a 2010-01-01 00:00:00.000
4 b 2010-01-02 00:00:00.000

(4 ÐÐÊÜÓ°Ïì)
*/


SQL code:
select
*
from
tb


Ïà¹ØÎÊ´ð£º

sqlÐÔÄÜÇóÖú - MS-SQL Server / ÒÉÄÑÎÊÌâ

³¡¾°ÈçÏ£º
¿Í»§°Ñ±¸·ÝºÃµÄÊý¾Ý¿â£¬·¢¸øÎÒ£¬ÎÒÔÚ±¾»ú»¹Ô­ºó£¬ÔËÐÐдºÃµÄ´æ´¢¹ý³Ì£¬±È½Ï¿ì£¬²¢ÇÒÔÚʵʩÄDZßÔËÐÐͬÑù±È½Ï¿ì¡£µ«Êǵ±ÊµÊ©ÔÚ¿Í»§ÄDZßÔËÐеÄʱºòËٶȾͷdz£µÄÂý£¬Ê±¼ä³¬³öÁ˳ÌÐòµÄʱ¼äÏÞÖÆ¡£Ô¶³ÌÔÚ¿Í»§ÄÇ ......

ÇóÒ»ÌõSQL - MS-SQL Server / ÒÉÄÑÎÊÌâ

--drop table #T1
--drop table #T2
create Table #T1(ID int,
QueryID nvarchar(20),
ResultID1 nvarchar(20),
ResultID2 nvarchar(20))
create Table #T2(SortNo int,
QueryID nvarchar(20),
ResultID1 nv ......

ASPÁ´½ÓSQLµÄ¼òµ¥µÇ½½çÃæ - .NET¼¼Êõ / ASP.NET

protected void btnLogin_Click(object sender, EventArgs e)
  {
  SqlConnection conn = new SqlConnection("Server = (local);user id = sa;pwd = 1;database = Login");
&nb ......

ÇóÒ»sqlÓï¾ä - MS-SQL Server / »ù´¡Àà

±í
id bh  
1 10
2 11
3 12 
4 15
5 16
6 22
7 25
8 26
9 27
10 28
½«bh°´Á¬Ðø·Ö¶Î³öÀ´·µ»Ø×Ö·û´®£º
10~12£¬15~16£¬22£¬25~28
SQL code:


declare @t tabl ......

sqlÓÅ»¯ - Oracle / »ù´¡ºÍ¹ÜÀí

select count(1) from FX_RETURNBOOKCHECKLIST fxreturnbo0_ where fxreturnbo0_.BOOKID='164 ' AND fxreturnbo0_.RETURNID='00025.S0000001' 
ÉÏÃæÒ»¸ö¼òµ¥µÄSQL,Ö´ÐÐʱ¼ä2.6à ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ