首页 > 其他分享 >子查询、Concat 字符拼接 ,Cast截取小数位 函数使用

子查询、Concat 字符拼接 ,Cast截取小数位 函数使用

时间:2023-12-01 09:55:04浏览次数:53  
标签:dbo CaseId Cast sh Concat 小数位 qh where select

select qh.CaseId 
,(select sh.CaseId from ServiceQuot.dbo.Header sh where qh.QutoNo = sh.HeaderNo) 
,qh.ApplierDate 
,qh.BU 
,qh.Site 
, qh.HeaderNo 
, qh.Currency 
(select sh.Customer from ServiceQuot.dbo.Header sh where qh.QutoNo = sh.HeaderNo)
, qh.PN 
,qh.QutoNo 
,(select sum(ql.Num) from QAPriceContrast.dbo.Line ql where ql.CaseId = qh.CaseId) 
,( select ( select sdl.SPMCost from ServiceQuot.dbo.Line sdl where qh.QutoLineId = sdl.LineId and shf.CaseId = sdl.CaseId) SpmCost from ServiceQuot.dbo.Header shf where qh.QutoNo = shf.HeaderNo ) 
,qh.CalQutoHumanCost 
,qh.CalQuotMaterilCost    
,qh.CalQuotOtherPrice 
,qh.CalQutoCostCount
,qh.CalActualHumanCost    
,qh.CalActualMaterialCost 
,qh.ActualOtherPrice 
,qh.CalActualCostCount
,qh.CalQutoHumanCost - qh.CalActualHumanCost    
,qh.CalQuotMaterilCost - qh.CalActualMaterialCost     
,qh.CalQuotOtherPrice -  qh.ActualOtherPrice  
,(qh.CalQutoHumanCost - qh.CalActualHumanCost) + (qh.CalQuotMaterilCost - qh.CalActualMaterialCost) + (qh.CalQuotOtherPrice -  qh.ActualOtherPrice)    
, CONCAT( cast (((qh.CalQutoCostCount - qh.CalActualCostCount) / qh.CalActualCostCount) * 100 as numeric(10, 2)),'%') 

from QAPriceContrast.dbo.Header qh where qh.CalActualCostCount is not null

 

标签:dbo,CaseId,Cast,sh,Concat,小数位,qh,where,select
From: https://www.cnblogs.com/lixia0604/p/17869079.html

相关文章

  • static_cast<>
    static_cast<>在C++中有以下几个优点:类型检查:static_cast<>在编译时期进行类型检查,如果类型转换不合法,编译器会报错。这是它相比C风格类型转换的一个重要优势,因为C风格类型转换不进行类型检查,可能会导致类型转换错误代码清晰:static_cast<>的出现,使得类型转换更容易在代码......
  • 存储机制(Window.sessionStorage 和 Window.locaStorage)
    <!DOCTYPEhtml><html><head><metacharset="utf-8"><title>webStorage</title><!--1.存储内容大小一般支持5MB左右(不同浏览器可能不一样)2.浏览器通过Window.sessionStorage和Window.locaStorage属性来实现本地存储机制3.相关API:1.XXXXXStorage.setItem('......
  • Flutter开发type 'Future<int>' is not a subtype of type 'int' in type cast错误
    问题描述今天调试flutter程序时报错。程序运行时报如下错误:type'Future<int>'isnotasubtypeoftype'int'intypecast错误源码intorder=DatabaseHelper.dbhelper.getTaskGroupRelationOrder()asint;......
  • 使用skforecast进行时间序列预测
    时间序列预测是数据科学和商业分析中基于历史数据预测未来价值的一项重要技术。它有着广泛的应用,从需求规划、销售预测到计量经济分析。由于Python的多功能性和专业库的可用性,它已经成为一种流行的预测编程语言。其中一个为时间序列预测任务量身定制的库是skforecast。在本文中,将......
  • MDns C# 实现 Makaretu.Dns.Multicast
     1、创建一个DNS服务:可以使用MulticastService类来创建一个DNS服务实例,并为其指定主机名和端口号。varservice=newMulticastService("mydns.local",IPAddress.Parse("224.0.0.251"),5353);2、添加DNS解析记录:可以使用ServiceAnnouncement类来添加DNS解析记录,并将其......
  • Windows下mDNS查询API—DnsStartMulticastQuery/DnsStopMulticastQuery的使用
    背景及问题:目前很多局域网设备通过mNDS协议实现互联,IP地址为自动IP段-169.254.x.x,有时候设备厂家提供的API需要通过知晓局域网中的IP地址/设备名,才能连接该设备。这样要求每个软件必须配置设备名或者启动时遍历所有IP(6w+),不是很方便,这时候可以通过mDNS查询,自动拿到设备名,再进行连......
  • input如何校验数字为正整数位数与小数位数
    1.表单中内容为<el-form><el-form-item:prop="minPrice":rules="{required:true,validator:PriceValidator,trigger:'blur',}"><el-inputtype="Number"min="1"v-model="......
  • Trancastional
    在SpringBoot中,使用@Transactional注解可以开启事务管理。默认情况下,@Transactional注解只对当前线程有效,也就是说,只有在使用@Transactional注解的方法中,才会开启事务。如果在一个使用@Transactional注解的方法中,启动了一个新的线程,那么这个新线程并不会自动继承父线程的事务。......
  • SQL_SERVER CAST 和 CONVERT
    语法CAST(expressionASdata_type[(length)])CONVERT(data_type[(length)],expression[,style]) 日期和时间样式转换日期和时间数据类型--转换日期和时间数据类型DECLARE@d1DATE,@t1TIME,@dt1DATETIME;SET@d1=GETDATE();SET@t1......
  • concat操作不会改变现有的数组,而仅仅会返回被连接数组的一个副本
    在前提:vararr=[1,3,2]下,下面哪个操作会返回一个数组,并且不是arr?Aarr.push(3)Barr.reverse()C[].concat.call(arr,[])D[].sort.call(arr)正确答案:C因为concat操作不会改变现有的数组,而仅仅会返回被连接数组的一个副本1.contact函数的功能是:连接两个或多个数组。将返回......