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

ÈÕÆÚǰһÌìµÄsqlÓï¾ä

Êý¾Ý¿â±íAAA ×Ö¶ÎÈçÏÂ
a  b    c

A 10 2009-01-01

A 11 2009-01-02

A 12 2009-01-03

B 23 2009-01-01

B 24 2009-01-02

B 25 2009-01-03

C 17 2009-01-01

C 19 2009-01-02

C 25 2009-01-03


ÒªÇóËÑË÷³ö×î´óµÄÒ»ÌìÓë×î´óµÄÒ»Ìì֮ǰһÌ죬bµÄ±ÈÖµ£¬½á¹ûÈçÏÂ

A 12/11

B 25/24

C 25/19
SQL code:

sql server 2005:
select *
from (select id=row_number() over(order by c desc),* from tb) K
where id<=2


SQL code:
select m.a , cast(m.b as varchar) + '/' + cast(n.b as varchar) from
(select t.* , px = (select count(1) from tb where a = t.a and c > t.c) + 1 from tb t) m,
(select t.* , px = (select count(1) from tb where a = t.a and c > t.c) + 1 from tb t) n
where m.a = n.a and m.px = 1 and n.px = 2


SQL code:
create table tb(a varchar(10), b int, c datetime)
insert into tb values('A', 10 ,'2009-01-01')
insert into tb values('A', 11 ,'2009-01-02')
insert into tb values('A', 12 ,'2009-01-03')
insert


Ïà¹ØÎÊ´ð£º

sqlת»»ÎÊÌ⣬¼±£¡ - ÉçÇøÖ§³Ö / ¡¶³ÌÐòÔ±¡·ÔÓÖ¾

select convert(varchar(50),cast(convert(numeric(18,2),1275674000000/100000000)as real))+'ÒÚ'
select cast(convert(numeric(18,2),1275674000000/100000000)as real)
ΪʲôÉÏÒ»¸öÓÃvarcharת»»ºó¾ÍÖ»±£ÁôÁËÒ ......

jspÁ´½Ósql2000µÄÒÉÎÊ£¿



type Exception report


message

description The server encountered an internal error () that prevented it from fulfilling this request.

exception

org.apache.jas ......

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 ......

ÈçºÎʹÓÃMySQL - MS-SQL Server / »ù´¡Àà

¸Õ¸Õ½Ó´¥MySQL,²»ÖªµÀ¸ÃÈçºÎÈ¥²é¿´Êý¾Ý£¬²åÈëÊý¾Ý£¬´´½¨Êý¾Ý¿â¡¢±í£¬ÓÃÄÄΪǰ±²ÄÜÖ¸½ÌÒ»¶þ£¿

MySQL 5.1²Î¿¼ÊÖ²á

ÒýÓÃ
ÐÖµÜÄã»á½áÌùÂð£¿
mysql ²Î¿¼ÊÖ²á

baidu

MySQL¹Ù·½Îĵµ http://dev.mysql.com/doc ......

ÇóÒ»¸ö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 ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ