打印本文 打印本文 关闭窗口 关闭窗口
Transact SQL 常用语句以及函数
作者:武汉SEO闵涛  文章来源:敏韬网  点击数11922  更新时间:2007/11/14 13:12:55  文章录入:mintao  责任编辑:mintao
10,20,30
     
order by stockid desc(asc--------- 排序,desc-降序,asc-升序 
     order by 1,2 --------- by列号 
     stockname = (select stockname from stock_information where stockid = 4
     
--------- 子查询 
     --------- 除非能确保内层select只返回一个行的值 
     --------- 否则应在外层where子句中用一个in限定符 
     select distinct column_name form table_name 
   
--------- distinct指定检索独有的列值,不重复 
     select stocknumber ,"stocknumber + 10= stocknumber + 10 from table_name 
     
select stockname , "stocknumber" = count(*from table_name group by stockname 
     
--------- group by 将表按行分组,指定列中有相同的值 
     having count(*= 2 --------- having选定指定的组 

   
select * 
     
from table1, table2 
where table1.id *= table2.id -------- 左外部连接,table1中有的而table2中没有得以null表示 
     table1.id =* table2.id -------- 右外部连接 
     select stockname from table1 
     
union 

上一页  [1] [2] [3] [4] [5] [6] [7] [8] [9] [10]  ...  下一页 >> 

打印本文 打印本文 关闭窗口 关闭窗口