SELECT t1.id, t1.[gf] AS '供方', t1.[htmc] AS '合同名称', t1.[htbh] AS '合同编号', t1.[sjbh] AS '编号', t1.[qdrq] AS '签订日期', t1.[qsrq] AS '起始日期', t1.[jzrq] AS '截止日期', t1.[zje] AS '总金额', t1.[zds] AS '总吨数', t1.[lrsj] AS '创建时间', CONCAT ( MONTH ( t1.[rksj] ), '月' ) AS '入库时间', t1.[chpt] AS '撮合平台', t1.[qsfs] AS '签署方式', t1.[gfjc] AS '供方简称', t1.[cclx] AS '持仓类型', CAST ( t1.[htwj] AS VARCHAR ( MAX ) ) AS '合同文件', STUFF( ( SELECT ',' + CONVERT ( VARCHAR, CASE WHEN ISNUMERIC( REPLACE( t2.pp, ',', '' ) ) = 1 THEN CAST ( REPLACE( t2.pp, ',', '' ) AS FLOAT ) END ) FROM uf_cght2_dt1 t2 WHERE t1.id = t2.mainid FOR XML PATH ( '' ) ), 1, 1, '' ) AS '品牌', STUFF( ( SELECT ',' + CONVERT ( VARCHAR, CASE WHEN ISNUMERIC( REPLACE( t2.hsdj, ',', '' ) ) = 1 THEN CAST ( REPLACE( t2.hsdj, ',', '' ) AS FLOAT ) END ) FROM uf_cght2_dt1 t2 WHERE t1.id = t2.mainid FOR XML PATH ( '' ) ), 1, 1, '' ) AS '采购单价', SUM ( t3.[sjfk] ) AS '实际已付', SUM ( t3.[hkje] ) AS '已付货款', ( SELECT SUM ( sjfk ) FROM uf_cgfksjb WHERE kxlx = 0 AND cght = t1.id ) AS '订金', CASE WHEN (SELECT SUM(sjfk) FROM uf_cgfksjb WHERE kxlx = 0 AND cght = t1.id) + SUM(t3.[hkje]) < t1.[zje] THEN ROUND(SUM(t3.[hkje]) / t1.[zje], 3) ELSE ROUND(((SELECT SUM(sjfk) FROM uf_cgfksjb WHERE kxlx = 0 AND cght = t1.id) + SUM(t3.[hkje])) / t1.[zje],3) END AS '已付比例' FROM uf_cght2 t1 INNER JOIN uf_cght2_dt1 t2 ON t1.id = t2.mainid LEFT JOIN uf_cgfksjb t3 ON t1.id = t3.cght GROUP BY t1.id, t1.[gf], t1.[htmc], t1.[htbh], t1.[sjbh], t1.[qdrq], t1.[qsrq], t1.[jzrq], t1.[zje], t1.[zds], CONCAT ( MONTH ( t1.[rksj] ), '月' ), t1.[chpt], t1.[lrsj], t1.[qsfs], t1.[gfjc], t1.[cclx], CAST ( t1.[htwj] AS VARCHAR ( MAX ) );怎么按签定日期倒序排序
时间: 2024-01-21 15:02:29 浏览: 85
CHTMLDemo.rar
下的保密信息进行保密,并未经对方的书面同意不得向第三方披露。
5.2 本协议项下的保密信息包括但不限于商业机密、技术资料、源代码您可以使用ORDER BY子句来按照签订日期(qdrq)的倒序对结果进行排序。以下是修改后的查询语句:
```sql
SELECT
t1.id,
t1.[gf] AS '供方',
等。
六、费用与付款方式
6.1 开发过程中产生的费用由各方按照约定比例承担。
6.2 各方同意按照约定的付款方式进行费用的结算和 t1.[htmc] AS '合同名称',
t1.[htbh] AS '合同编号',
支付。
七、风险和责任
7.1 双方将共同承担开发过程中的风险和 t1.[sjbh] AS '编号',
t1.[qdrq] AS '签订日期',
t1责任,并在出现问题时积极合作解决。
7.2 如因一方原因导致系统开发.[qsrq] AS '起始日期',
t1.[jzrq] AS '截止日期',
t无法继续或延迟交付,对方有权要求违约方承担相应的责任和损失1.[zje] AS '总金额',
t1.[zds] AS '总吨数',
t1.[。
八、争议解决
8.1 本协议的解释和执行均适用中华人民共和lrsj] AS '创建时间',
CONCAT (MONTH(t1.[rksj]), '月') AS '入库时间国法律。
8.2 如双方因本协议发生争议,应通过友好协商解决;如',
t1.[chpt] AS '撮合平台',
t1.[qsfs] AS '签署方式协商不成,应提交至有管辖权的人民法院裁决。
九、其他条款
9.1',
t1.[gfjc] AS '供方简称',
t1.[cclx] AS '持仓 本协议自双方签署之日起生效,有效期为系统交付之日起[有效期]。
类型',
CAST(t1.[htwj] AS VARCHAR(MAX)) AS '合同文件',
STUFF(
(
9.2 本协议未约定事项或有关事项的修改、补充应经双方书面确认 SELECT ',' + CONVERT(
VARCHAR,
CASE
WHEN ISNUMERIC(REPLACE(t2.pp, ',', '')) = 1 THEN。
9.3 本协议的附件与正文具有同等法律效力。
请各方确认并签署本协议以示同意。
甲方:_________________
乙方:_________________
阅读全文