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

¡¾Ð¡Ð¡ÎÊÌ⼯½õ13Ö® ¹ØÓÚ·Ö×é¼Ó˳ÐòºÅµÄSQLд·¨¡¿


/*
Ô­±í£º  
thid      other  
a              1  
a              1  
b              0  
b              0  
b              0  
c              2    
c              2  
Ï£Íû±ä³É£º  
thid      other  
a              1  
a              2  
b              0  
b              1  
b              2  
c              2    
c              3  
*/
if OBJECT_ID('tb') is not null
drop table tb 
go
create table tb (id varchar(10) ,value int)
insert tb select 
'a'  ,            1  union all select 
'a'  ,            1  union all select
'b'  ,            0  union all select
'b'  ,            0  union all select
'b'  ,            0  union all select
'c'  ,            2  union all select 
'c'  ,   &nb


Ïà¹ØÎĵµ£º

5±¾¾­µäSQLµç×ÓÊé


SQL±¦µä

SQL±ØÖª±Ø»áµÚÈý°æ

SQLÈëÞ­µäµÚËİæ

Sams Teach Yourself SQL in 10 Minutes Third Edition

SQL The Complete Reference

......

SQL֪ʶÕûÀí

Ò»£ºSelectÓï¾ä£º
       select ×Ö¶ÎÃû from ±íÃû where Ìõ¼þ order by ÅÅÐò
see:select distinct ´Ó¶à¸öÏàͬ×Ö¶ÎÖÐץΨһֵ    
see:²éÕÒld_det_andy±íÖÐÓÐÊý¾Ýµ«ld_det_temp±íÖÐûÊý¾ÝµÄÊý¾Ý
        select * from ld_det_a ......

½«SQL ServerÊý¾Ý¿âÖмǼµ¼³öΪinsertÓï¾ä

   ÓÐʱÔÚ×ö³ÌÐòʱ£¬²âÊÔʱµÄÊý¾Ý£¬ÒªÄÃÏñÓû§ÑÝʾ£¬Êý¾Ý¿âµÄ¸½¼ÓÊÇ×îÖ±½ÓµÄ°ì·¨£¬µ«Èô´ÓSQL Server 2005תÏò2000µ¼³öÂé·³£¬ÄÚÈÝÒ²¶à£¬Éú³ÉSQLÓï¾äÊÇ×îºÃµÄ°ì·¨£¬Ò²ÊÇÔÚÍøÉÏÕҵŤ¾ß,mssql2µ¼³ö·Ç³£·½±ã£¬µ£ÐÄÎÒÒÔºóÄѵÃÕÒËùÒÔ·ÅÔÚÕâÀÒÔ±¸ºóÓᣠ......

sqlÓï¾ä

select *from student
select student_id from student
select student_id ,student_name from student
select student_id student_name from student  ½«student_name ×÷Ϊstudent_idµÄ±ðÃû´¦Àí
È磺   select student_id a from student
 select a=student_id from student
´Óstudent±íÖзֱð¼ ......

Sql Server µÄÐÔÄܲâÊÔÊý¾ÝµÄÏÝÚå

Êý¾Ý¿âµÄÐÔÄܲâÊÔ¿ÉÒÔ°ïÖúÄãÌáǰ֪µÀÄãµÄϵͳµÄ¸ºÔØÄÜÁ¦£¬¿ÉÒÔ°ïÖúÄã¸Ä½øÏµÍ³µÄʵʩ»òÉè¼Æ£¬¿ÉÒÔ°ïÖúÄãÈ·¶¨Ò»Ð©Éè¼ÆºÍ±à³ÌÔ­Ôò. µ«ÊÇ£¬ÕâÀïÃæÒ²ÓÐÏÝÚå. Èç¹û²»Ð¡ÐÄ£¬Äã»á×Ô¼º°Ñ×Ô¼ºÏݽøÈ¥£¬È´×îÖÕ²»Ã÷°×ÊÇʲôԭÒò. ÕâÀÎÒÄÃһλÏÈÉúΪÀý£¬À´¿´¿´ËûÔõô×Ô¼º°Ñ×Ô¼º¸ãºýÍ¿µÄ.
×î½ü, ÏëÆðÔÚ´æ´¢¹ý³ÌÖо¿¾¹ÊÇʹÓÃÁÙʱ±í»¹ÊÇÊ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ