SELECT t1.id, t1.[requestId] AS t1_requestId, 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.[rksj] AS '入库时间', t1.[chpt] AS '撮合平台', t1.[htwj] AS '合同文件', t1.[qsfs] AS '签署方式', t1.[gfjc] AS '供方简称', t1.[cclx] AS '持仓类型', CAST(STUFF( ( SELECT ',' + CONVERT(VARCHAR, CASE WHEN ISNUMERIC(REPLACE(t2.hsdj, ',', '')) = 1 THEN CAST(REPLACE(t2.hsdj, ',', '') AS FLOAT) END ) FROM formtable_main_43_dt1 t2 WHERE t1.id = t2.mainid FOR XML PATH('') ), 1, 1, '' ) AS FLOAT) AS '采购单价' FROM formtable_main_43 t1 INNER JOIN formtable_main_43_dt1 t2 ON t1.id = t2.mainid GROUP BY t1.id, t1.[requestId], t1.[gf], t1.[htmc], t1.[htbh], t1.[sjbh], t1.[qdrq], t1.[qsrq], t1.[jzrq], t1.[zje], t1.[zds], t1.[rksj], t1.[chpt], t1.[htwj], t1.[qsfs], t1.[gfjc], t1.[cclx];提示不能比较或排序 text、ntext 和 image 数据类型,除非使用 IS NULL 或 LIKE 运算符
时间: 2024-04-27 20:21:54 浏览: 65
CHTMLDemo.rar
这是一个 SQL 查询语句,它从表格 formtable_main_43 和 formtable_main_43_dt1 中获取数据,并使用内部联接将它们组合起来。查询结果包括 t1 表格中的一些列,以及一个采购单价列。但是,查询语句提示了一个错误:不能对文本、ntext 和 image 数据类型进行比较或排序,除非使用 IS NULL 或 LIKE 运算符。这可能是因为查询中涉及了这些数据类型的列,但没有使用适当的运算符来处理它们。
阅读全文