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

mssql Çó¶à×Ö¶Î×î´óÖµ

//Ïà¹Øsql
SQL code:

create table tb1
(
tId int,
tName nvarchar(20),
class1 int,
class2 int
)
insert into tb1
select 1,'test',10,20
union all
select 1,'test1',20,35
union all
select 1,'test2',30,30
union all
select 2,'test21',30,85
union all
select 2,'test22',50,75
union all
select 3,'test31',60,65
union all
select 3,'test32',70,70



//µ¥¸ö×ֶεĻᣬÏÂÃæÊÇÇ󵥸ö×ֶεÄ
SQL code:

select a.* from tb1 a,(select tId,max(class1) as maxT from tb1 group by tId) b
where a.tId=b.tId and a.class1=b.maxT order by a.tId



//Êý¾ÝÏÔʾÈçÏÂ
SQL code:

tId tName class1 class2
1 test2 30 30
2 test22 50 75
3 test32 70 70



//ÎÒÏëÏÔʾΪ
SQL code:

tId tName maxClass
1 test2 35
2 test22 85
3 test32 70



ÎÒÏëÒªµÄ½á¹û¾ÍÊÇclass1,class2²»Çø·Ö£¬È¡×î´óÖµ¡£

//лл¡£
SELECT TID,TNAME,MAX(CLASS1 )
from (
SELECT TID,TNAME,CLASS1 from TB
UNION


Ïà¹ØÎÊ´ð£º

MSSQL 2000 連½Ó MSSQL 2008

ÓÐ沒ÓÐ辦·¨實現£¬從MSSQL2000Æó業¹ÜÀíÆ÷註冊MSSQL2008數據庫£¿
Á¬²»ÉϰÉ

Ã²ËÆ沒Ï£Íû¡£¡£¡£

Ó¦¸ÃÊDz»ÐÐµÄ ¿çÌ«¶àÁË

ÄÇ2000µÄ ......

MSSQLÔõô»ñÈ¡Êý¾Ý¿âÀúÊ·²éѯ×Ü´ÎÊý

ÈçÌ⣬MYSQLÓÖÔõô»ñÈ¡£¿
ÈçÌâ

Õâ¸ö¹À¼ÆÔÚÈÕÖ¾ÎļþÖвÅÄÜ¿´¼û°É

Õâ¸ö¹À¼ÆÔÚÈÕÖ¾ÎļþÖвÅÄÜ¿´¼û°É


ÒýÓÃ
³ý·ÇÄãÒµÎñÉÏ×ö¼Ç¼£¬·ñÔòÄãÊDz»ÄÜÖªµÀµÄ¡£ÒòΪÈÕÖ¾²»¼Ç¼selectÓï¾äÃüÁî¡£
..

ÄÇÓÐûÓÐϵͳ´ ......

mssqlÈ¥³ýÖØ¸´²¢ÅÅÐòµÄÎÊÌâ

SQL code:
/*
create database temp
use temp
create table employees
(
eID int identity primary key,
eName nvarchar(50) not null,
eSex smallint not null default(1),
eSort smalli ......

mssql sql¼ò»¯

SQL code:

declare @begin datetime --¿ªÊ¼Ê±¼ä
declare @end datetime --½áÊøÊ±¼ä
declare @startIndex int --ÆðʼֵĬÈÏΪ8
declare @interval int --ʱ¶Î³¤
select @startIndex=8
select @ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ