易截截图软件、单文件、免安装、纯绿色、仅160KB
热门标签: c c# c++ asp asp.net linux php jsp java vb Python Ruby mysql sql access Sqlite sqlserver delphi javascript Oracle ajax wap mssql html css flash flex dreamweaver xml
 最新文章 : sql

SQL两个表统计

SQL code:

---测试数据---
if object_id('[grxs]') is not null drop table [grxs]
go
create table [grxs]([tc_name] varchar(2),[tc_sex] int,[sj] datetime)
insert [grxs]
select '张',-1 ,'2010-2-4' union all
select '张',-3 ,'2010-2-4' union all
select '王',-2 ,'2010-2-4' union all
select '李',- ......

求一个SQL语句

表A结构及数据示例如下:

NAME    TIME1        TIME2
---------------------------------
TOM    2009-01-01    2009-01-02
JACK    2010-01-01    2010-02-03
TOM    2009-01-01    2009-07-02
TOM ......

帮忙看一下,怎么写sql 排序

排序前
5 245 405
5 245 406
5 239 396
5 239 395
5 240 398
5 240 397
5 241 399
5 241 400
5 242 401
5 242 402
要求排序后
5 245 405
5 245 406
5 239 395
5 239 396
5 240 397
5 240 397
5 241 398
5 241 400
5 242 401
5 242 402

先谢谢了。 ......

请教这样的SQL怎么写

表:
group    value
1        1
1        2
1        3
2        1
2        3
3        1
3        3

每一组中(id)取一个值, ......

SQL语句问题,在线等

执行该段
select * from
(
select a.*,b.register_date,b.staff_msisdn,b.归属机构
from (select * from lmf_hlwzx_200912 where to_char(create_time,'yyyymm')=200912) a,
    (select * from qz_jj_1.ban_dj_200912_done where 积分项目 like '%专线%') b
where a.paymen ......

一个简单的SQL语句

select
sum(case a when 0 then b else 0 end) as qty1,
sum(case a when 1 then b else 0 end) as qty2,
sum(b) - qty1 - qty2 as qty3  //qty3我是想实现这样的功能,但我知道这样写肯定不对,不知道怎么能实现?
from table1
group by...
SQL code:
select
sum(case a when 0 then b else 0 end ......
总记录数:3315; 总页数:553; 每页6 条; 首页 上一页 [204] [205] [206] [207] 208 [209] [210] [211] [212] [213]  下一页 尾页
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号