修改 错误 SELECT pr.PRODUCT_ID, pr.PRODUCT_NAME, pr.ORIGINAL_PRICE, pr.ONLINE_PRICE, pr.COMMISSION_PERCENT, pr.TOTAL_SALES, pr.SHOP, dict.label AS COMMERCE_TYPE_LABEL, pr.SERVICE_RATE, ord.ORDER_ID, date.label AS SEND_FLG_LABEL, pro.CONNECT_BUSINESS_FLG, address.APPLY_REMARK, address.CREATE_TIME, users.nicknameFROM t_product AS prLEFT JOIN t_order AS ord ON ord.PRODUCT_ID = pr.IDLEFT JOIN ( SELECT label, `value` FROM system_dict_data WHERE dict_type = 'COMMERCE_TYPE' ) AS dict ON dict.`value` = pr.COMMERCE_TYPE LEFT JOIN ( SELECT label, `value` FROM system_dict_data WHERE dict_type = 'trade_after_sample_type' ) AS date ON date.`value` = ord.SEND_FLGLEFT JOIN t_apply_pro AS pro ON pro.PRODUCT_ID = pr.IDLEFT JOIN t_apply_pro_user_address AS address ON address.t_apply_pro_id = pro.IDLEFT JOIN system_users AS users ON users.id = pro.OPERATE_USER_ID WHERE users.id = '1'
时间: 2024-02-29 22:55:33 浏览: 161
LABVIEW程序实例-DS写属性数据.zip
以下是修改后的SQL语句,主要是为了使语句更加易读和易懂:
```
SELECT
pr.PRODUCT_ID,
pr.PRODUCT_NAME,
pr.ORIGINAL_PRICE,
pr.ONLINE_PRICE,
pr.COMMISSION_PERCENT,
pr.TOTAL_SALES,
pr.SHOP,
dict.label AS COMMERCE_TYPE_LABEL,
pr.SERVICE_RATE,
ord.ORDER_ID,
date.label AS SEND_FLG_LABEL,
pro.CONNECT_BUSINESS_FLG,
address.APPLY_REMARK,
address.CREATE_TIME,
users.nickname
FROM
t_product pr
LEFT JOIN t_order ord ON ord.PRODUCT_ID = pr.ID
LEFT JOIN (
SELECT label, `value`
FROM system_dict_data
WHERE dict_type = 'COMMERCE_TYPE'
) AS dict ON dict.`value` = pr.COMMERCE_TYPE
LEFT JOIN (
SELECT label, `value`
FROM system_dict_data
WHERE dict_type = 'trade_after_sample_type'
) AS date ON date.`value` = ord.SEND_FLG
LEFT JOIN t_apply_pro pro ON pro.PRODUCT_ID = pr.ID
LEFT JOIN t_apply_pro_user_address address ON address.t_apply_pro_id = pro.ID
LEFT JOIN system_users users ON users.id = pro.OPERATE_USER_ID
WHERE
users.id = '1'
```
修改后的SQL语句对语句进行了格式化和缩进,使得语句更加易读和易懂。同时,还对表名和字段名进行了简化,以减少语句的长度,使其更加简洁。
阅读全文