首页 > 代码库 > UNION ALL 小结
UNION ALL 小结
[Err] 1222 - The used SELECT statements have a different number of columns 是因为两个select 语句的查询元素个数不一致导致的,如SELECT
*
FROM
(
SELECT
province_code,
province_name,
category_code,
category_name,
logic_warehouse_name,
BUSINESS_TYPE AS inputbusiness_type,
order_no AS inputorder_nofrom,
products_nums,
total_amount AS inputtotal_amount,
`status` AS inputstatus,
warehouse_usage,
input_time AS state_time
FROM
es_ctwh_stock_input
WHERE
source_from = ‘CTWH‘
AND PROVINCE_CODE = ‘110000‘
UNION ALL
SELECT
warehouse_usage,
provider_code,
province_name,
business_type AS outputbusiness_type,
order_no AS outputorder_no,
category_code,
category_name,
output_nums,
total_amount AS outputtotal_amount,
provider_code,
provider_name,
`status`,
output_time AS state_time
FROM
es_ctwh_stock_output
WHERE
source_from = ‘CTWH‘
AND province_code = ‘110000‘
) a
UNION ALL 小结