电信服务器收费注解

SELECT '电话' + cast(call.phonenumber as varchar(11)) + '费用' + cast((SUM(DATEDIFF(MI,call.starttime,call.endtime))

+ SUM(DATEDIFF(MI,[call-history].starttime,[call-history].endtime))) * 0.7 as varchar(20))

FROM call INNER JOIN

[call-history] ON call.phonenumber = [call-history].phonenumber

where call.calltype=1 and [call-history].calltype=1

group by call.phonenumber,[call-history].phonenumber

 

加粗,下划线字体为注解

 

SELECT '电话'      查找电话 + cast(call.phonenumber as varchar(11))       转换call.phonenumber表成11为数字    + '费用' + cast((SUM(DATEDIFF(MI,call.starttime,call.endtime)) 转换call.starttime,call.endtime 表中时间差

+ SUM(DATEDIFF(MI,[call-history].starttime,[call-history].endtime))) * 0.7 as varchar(20))

转换 [call-history].starttime,[call-history].endtime 表中时间差】 乘0.7 结果限制20位

FROM call INNER JOIN

[call-history] ON call.phonenumber = [call-history].phonenumber

查找 call 表中 内链接 中 [call-history] 表中 call.phonenumber 列 =[call-history] 表中的phonenumber 列 where call.calltype =1查找call 表.calltype 列中等于1的值 and 和 [call-history].calltype=1 [call-history] 表 calltype 列中等于1的值

group by   聚合  call.phonenumber call    表中  phonenumber ,  的列和

[call-history] .phonenumber call-history  表中 phonenumber 的列

你可能感兴趣的:(注解,职场,休闲,收费,电信服务器)