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

sql²éѯ²»Öظ´ - MS-SQL Server / ÒÉÄÑÎÊÌâ

regInfo ×¢²á±í
MemberId regDate
10001 2010-5-1
10002 2010-5-2
10003 2010-5-3
10004 2010-5-4
10005 2010-5-5
UserRecord ³äÖµ¼Ç¼±í
MemberId money dates
10001 5.00 2010-5-5
10002 10.00 2010-5-5
10001 15.00 2010-5-6
10003 5.00 2010-5-6
10001 10.00 2010-5-7 
10004 20.00 2010-5-7
²éѯµ±Ô ע²áµÄ»áÔ±³äÖµ10ÔªÒÔÉϵļǼ¡£Ö»±£ÁôµÚÒ»Ìõ³äÖµ½ð¶î´óÓÚ10µÄ¼Ç¼ ÒªÇóÏÔʾ½á¹û
10001 15.00 2010-5-6
10002 10.00 2010-5-5
10004 20.00 2010-5-7  
Õâ¸öÔõôд°¡
SQL code:
select t.* from UserRecord t , MemberId n where t.MemberId = n.MemberId and datediff(mm,n.regDate,getdate()) = 0 and t.money > 10 and t.money = (select top 1 money from UserRecord where money > 10 and MemberId = t.MemberId)


SQL code:
[del]select b.MemberId,max(A.money),min(dates) as FirstDay as MonthMoney from UserRecord a inner join regInfo b on a.MemberId=b.MemberId
where month(a.dates)=month(getdate()) group by a.MemberId
having max(A.money)>10[/del]


SQL code



Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighte


Ïà¹ØÎÊ´ð£º

Çë½ÌsqlÓï¾ä¡£ - Oracle / ¿ª·¢

ÎÒÓÐÒ»¸ö±í£¬½á¹¹ÊÇÕâÑù¡£
  ת³ö µ¥Î» תÈ뵥λ ±ÊÊý ½ð¶î
date(Ö÷) outid(Ö÷) inid(Ö÷) num amt
2009 1 2 1 500 Ϊ 1 µ¥Î» ÔÚ2009Ä ......

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

×Ö¶Î1,×Ö¶Î2.....×Ö¶ÎN,Status,ParentID
1,Name1....test1,1,99
1,Name1....test1,3,99
1,Name2....test2,1,101
1,Name2....test2,3,101
1,Name3....test3,2,101
1,Name1....test1,4,101
ÏëÒªµÄ½á¹ûÊÇ:
1,Na ......

Çë½ÌSQLÓï¾ä²éѯÎÊÌ⣿ - MS-SQL Server / »ù´¡Àà

ÎÒÏë²éѯ³öÿÌìÊý¾ÝµÄ×î´óµÄÒ»¸öÖµ¡£±íµÄ¸ñʽÈçÏÂ
±íÃû: hisdata
×Ö¶Î ±àºÅ Öµ ״̬ ʱ¼ä  
  Id value state dattime  
  101 32.3 0 ......

¹ØÓÚVbÖÐsqlÓï¾äµÄд·¨£¨100·Ö£© - Java / Web ¿ª·¢

Çó¸övbÖеÄsqlÓï¾äµÄд·¨£¬´ÎsqlÓï¾äµÄÓ÷¨ÊÇ·ÖÒ³³ÌÐò
ÎÒдµÄÈçÏ£ºÆäÖÐAÊÇÓÃÀ´½ÓÊÕÿҳÏÔʾµÄ¼Ç¼µÄÌõÊý£¬BÊÇÓÃÀ´½ÓÊÕÏÔʾµÄµ±Ç°µÄÒ³Ãæ.
sqltext="select top A * from log where id not in(select top ( ......

ÇóÒ»ÌõSQLÓï¾ä - MS-SQL Server / Ó¦ÓÃʵÀý

Ô­SQLÓï¾äSQL code:

SELECT t6.FName '²Ù×÷¹¤',t1.FDate 'ÈÕÆÚ',t5.FName 'ÖÆµ¥ÈË',t3.FName 'É豸',t4.FName '°àÖÆ',
t7.FBillNo '¹¤ÒÕÖ¸Áîµ¥ºÅ',t8.FName '¸Úλ',t2. ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ