Çë½ÌSQLÓï¾ä²éѯÎÊÌ⣿ - MS-SQL Server / »ù´¡Àà
ÎÒÏë²éѯ³öÿÌìÊý¾ÝµÄ×î´óµÄÒ»¸öÖµ¡£±íµÄ¸ñʽÈçÏÂ
±íÃû: hisdata
×Ö¶Î ±àºÅ Öµ ״̬ ʱ¼ä
Id value state dattime
101 32.3 0 2010-4-7 12£º34£º56
102 19.2 1 2010-4-7 12£º34£º46
103 23.2 0 2010-4-7 14£º21£º02
101 32.3 0 2010-4-7 15£º13£º31
102 19.2 1 2010-4-7 15£º28£º24
103 23.2 0 2010-4-7 15£º27£º46
--- ---- -- ------
--- ----- --- ------
101 32.3 0 2010-4-10 7£º56£º24
102 19.2 1 2010-4-10 7£º31£º32
103 23.2 0 2010-4-10 8£º19£º15
±ÈÈçÒª²éѯ2009Äê4ÔÂ7ÈÕºÍ4ÔÂ10ÈÕÖ®¼ä ±àºÅΪ101µÄÿÌìÊý¾ÝµÄ×î´óÖµ£¬ÈçºÎд²éѯÓï¾ä лл
up.
SQL code:
select max(value) as maxValue,convert(varchar(10),[dattime],120) as [date]
from hisdata
where convert(varchar(10),[dattime],120) between '2009-04-07' and '2009-04-10'
and Id=101
group by convert(varchar(10),[dattime],120)
select top 1 datetime from testtable4 where Id='101' and convert(datetime,datetime1) between convert(datetime,'2010-04-07 12:00:00') and conve
Ïà¹ØÎÊ´ð£º
´ÓÊý¾Ý¿âÖвéѯһÕűíµÄÊý¾Ý
select ²¿ÃÅ,ÐÕÃû from tb
ÈçºÎ²ÅÄÜÉú³ÉÏÂÃæµÄxml¸ñʽ
XML code:
<folder state="unchecked" label="È«²¿">
¡¡¡¡ <folder state="unchecked&qu ......
tab1 ×Ö¶Î:billdate,goodsid,incount,inmoney,outcount,outmoney,endprice,endcount,endamt
tab2 ×Ö¶Î:goodsid,goodskind£¨ÉÌÆ·ÀàÐÍ£©
tab3 ×Ö¶Î:goodskind£¨ÉÌÆ·ÀàÐÍ£©,kindname
½á¹û£º
µÃµ½ÉÌÆ·ÀàÐÍÔÚÒ»¶Îʱ¼ä ......
1¡£ÔõÑùʹxp_cmdshellÄÜÍêÕûÊä³ö³¬¹ý255¸ö×Ö·ûµÄ×Ö·û´®¡£
2¡£select ʱ£¬¼ìË÷ËÙ¶ÈÊÇÓëfromºóµÄ TABLE˳ÐòÓйأ¬»¹ÊÇÓëwhereÌõ¼þµÄ˳ÐòÓйØ(TABLEÊý¾Ý¶àÉÙ )
ÔÚϵͳÊôÐÔÉ趨ÀïÓиöÑ¡Ïî,¿ÉÒÔÐ޸ĵ¥×Ö¶ÎÊä³ö×ÖÊýÏÞÖÆ. ......
3̨µçÄÔ£¬ÆäÖÐһ̨×÷ΪMYSQL·þÎñÆ÷£¬ÁíÍâ2̨ΪTOMCAT·þÎñÆ÷¡£
MYSQL·þÎñÆ÷ÀïÓÐÒ»Ìõ¼Ç¼£¬ IDΪ10.
ÏÖÔÚ2̨TOMCATͬʱ£¨100%£©·¢ÆðÐÞ¸ÄMYSQLÀïIDΪ10µÄÄÇÌõ¼Ç¼£¬±ÈÈçÐ޸ĴËID¼Ç¼ÀïijһÏîµÄÄÚÈÝ¡£ ±ÈÈçTOMCAT 1Ò ......
ÇëÎÊÈçºÎʵÏÖÈçϲéѯ
Êý¾ÝÈçÏ£º
id name level
1 ¼× 1
2 ¼× 2
3 ÒÒ 1
4 ÒÒ 2
5 ÒÒ 3
6 ¶¡ 2
Ï£Íû½á¹ûÈçÏ£º
name level count
¼× 1 1/2
¼× 2 1/3
ÒÒ 1 1/2
ÒÒ 2 1/3
ÒÒ 3 1
¶¡ 2 1/3
°ÝÍÐÁË£º£©
......