易截截图软件、单文件、免安装、纯绿色、仅160KB

sql 加字段问题

sql 代码:
select step_title,(case  when cust_apply_duedate>GetDate() then '逾期' else '正常' end ) as status,count(*) as amount
from l_loan_info inner join L_step_info on l_loan_info.step_id=L_step_info.step_id
GROUP BY L_step_info.step_title,cust_apply_duedate
-------------------------------------
step_title  status  amount
  申请      逾期    2
  申请      正常    3
  审核      逾期    6
  审核      正常    4
-------------------------------------
我想在后面加 字段 “sum”

step_title  status  amount  sum
  申请      逾期    2      5
  申请      正常    3      5
  审核      逾期    6      10
  审核      正常    4      10
-----------------------------------
请问这样的sql 语句怎么写
再写一个GROUP BY的语句和现有的语句JOIN一下

SQL code:
select t1.* ,
(select sum(amount) from
(
select step_title,
(case when cust_apply_duedate>GetD


相关问答:

sql 截取字符串

我要得到一个字符串如:
sdfk|||sgts
sdfsfd|||rgreg
wrfw|||sefw
就是要得到|||后面的字符串,有什么函数吗?怎么用呢?谢谢!
SQL code:
select
right(col,len(col)-charindex('|||',col)-2)
f ......

sql语句的问题 - MS-SQL Server / 基础类

有2个表啊: 
表名:yh 
用户编码 用户名称  
001 a 
002 b 
003 c 
表名:ys 
用户编码 本期指数 抄表时间 
  001 ......

sql 存储过程

我要做一个定点事件,是每天晚上12点就把三个表里的信息放入一个表里,我想用存储过程来写,怎么写呢?,那位高手帮帮忙吧,非常感谢!

用户名是唯一的
表A  字段
用户名:Name  ,邮箱:Ema ......

一条sql语句 - MS-SQL Server / 基础类

Course(C#,Cname,T#) 课程表 
SC(S#,C#,score) 成绩表 
Teacher(T#,Tname) 教师表 
题目:把“SC”表中“叶平”老师教的课的成绩都更改为此课程的平均成绩; 
 update SC set sco ......

oracle中一个SQL语句的区别 - Oracle / 基础和管理

Oracle中SQL语句中
drop table 表名 cascadeconstraints

drop table 表名 cascadeconstraint
有什么区别?
constraint和constraints在oracle中是一样使用的
官方建议使用constraint

引用
constraint和c ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号