100·ÖÇó¸öSQLÓï¾ä - MS-SQL Server / Ó¦ÓÃʵÀý
ÈçºÎµÃµ½Ä³¼¾¶È»òijÔ·ÖÌØ¶¨Ê±¼ä¶ÎµÄÊý¾Ý
±ÈÈç:1-3ÔÂ,ÿÌìµÄÔç8µãµ½Íí5µãÊý¾Ý,ÊäÈëµÄʱºòÊäÈëÒ»¸öÆðʼʱ¼äÊäÈëÒ»¸ö½áÊøÊ±¼ä2¸ö²ÎÊý.
ÎÒÕâôдµÄ:
select * from yewutable
where
(timestamp between
convert(varchar(10),'2010-03-07 08:00:00',120)
and
convert(varchar(10),'2010-05-24 17:00:00',120)
)
and
(timestamp between
convert(varchar(8),'2010-03-07 08:00:00',108)
and
convert(varchar(10),'2010-05-24 17:00:00',108)
)
¿É"ʱ·ÖÃë"µÄÄǸöÌõ¼þÎÒû¸ã³öÀ´.Çë¸ßÊÖ°ïæ!лл
SQL code:
select * from yewutable
where [timestamp] between '2010-03-07 08:00:00' and '2010-05-24 17:00:00'
and convert(varchar(8),[timestamp],108) between '08:00:00' and '17:00:00'
-- convertº¯ÊýµÄµÚÒ»¸ö²ÎÊýÊÇÏÖʵÊä³öµÄ³¤¶È,Äã°Ñ³¤¶ÈÉèÖÃΪ19,¾Í¿ÉÒÔÁË,¿ÉÒÔ¿´ÏÂÃæµÄÀý×Ó.
select convert(varchar(19),getdate(),120)
convert(varchar(8),callstarttimestamp ,108) between '01:00:00' and '02:00:00'
Õâ¸öÈçºÎÔÚ'2010-05-24 17:00:00'ÖÐÌáÈ¡µ½?
convert(varchar(8),getdate(),108) ÕâÑù¿ÉÒÔ
convert(varchar(8),'2010-03-07 08:00:00',108) ÕâÑùÈ´²»ÐÐ.
ÎÒÊÇÐÂÊÖ¸ÃÔõôȥת»»ÄØ?
ѧϰÏ£¬¸ßÊÖ
SQL code
Code highlighting produced by Actipro CodeHighlighter (freeware)
http
Ïà¹ØÎÊ´ð£º
type Exception report
message
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
org.apache.jas ......
´ÓÊý¾Ý¿âÖвéѯһÕűíµÄÊý¾Ý
select ²¿ÃÅ,ÐÕÃû from tb
ÈçºÎ²ÅÄÜÉú³ÉÏÂÃæµÄxml¸ñʽ
XML code:
<folder state="unchecked" label="È«²¿">
¡¡¡¡ <folder state="unchecked&qu ......
ÓÐÕâÑùÒ»ÌõSQL
Select Get_Costtaxrate(col1), Get_Tcostvalue(col1) from a
ÆäÖÐGet_Costtaxrate¡¢Get_Tcostvalue¶¼ÊǺ¯Êý£¬ÕâÁ½¸öº¯ÊýÀïÃæ¶¼ÊDzéÕÒÒ»¸ö´ó±í£¬Get_Tcostvalue»¹ÐèÒªµ÷ÓÃGet_C ......
ÕâÀïÏëÁ˽âÏ£¬¹ØÓÚSQL ServerÖзÖÒ³ºÍOracleÖзÖÒ³£»
ƽ³£Ð´Ó¦ÓóÌÐòµÄʱºò£¬±ÈÈçÓõÄÓïÑÔÊÇJava£¬ÓиöÁбíÒ³Ãæ£¬ÐèÒª¶ÔÊý¾Ý·ÖÒ³ÏÔʾ£»
ÕâÀïÒª·ÖÒ³ÄѵÀ²»ÐèÒª½èÖúJava£¬¶øÖ±½ÓsqlÄÜÖªµÀ·ÖÒ³Âð£¬ÆðÂëÒ²Òª´«¸öÒ³Âë½ ......
select o_customer,o_price from orders having o_price >=avg(o_price)
select o_customer,o_price from orders where o_price >=(select avg(o_price) from orders)
ÎҸоõûÓÐÇø±ð°¡£¬ÔõôÔÚmysql»áÓÐ ......