报错:1267 - Illegal mix of collations (utf8mb4_0900_ai_ci,IMPLICIT) and (utf8mb4_general_ci,IMPLICIT)

本文探讨了在数据库查询中遇到的排序规则差异问题,如何通过LEFT JOIN解决edc_airline_resource_tempt和edc_airline_resource_spaces表的连接,确保在不同字符集规则下获取有效航班资源信息,重点在于时间范围筛选和空余座位查询。
SELECT 
		NULL as id, 
		t.source_id, 
		t.airline_name,
		t.flight_no,
		t.space_type,
		t.start_station,
		t.start_code,
		t.end_station,
		t.end_code,
		t.transfer_station,
		t.product_type,
		t.free_space,
		t.free_space,
		t.effect_date,
		NOW(),
		NOW() 
	FROM edc_airline_resource_temp t 
	LEFT JOIN edc_airline_resource_space s 
	ON s.effect_date=t.effect_date 
		and s.airline_name = t.airline_name 
		and s.flight_no = t.flight_no 
		and s.space_type = t.space_type 
		and s.start_station = t.start_station 
		and s.end_station = t.end_station 
		and IFNULL(s.transfer_station,'') = IFNULL(t.transfer_station,'') 
		and s.product_type = t.product_type 
	where t.effect_date >= CURDATE() 
		and t.effect_date<=ADDDATE(CURDATE(),2) 
		and s.id is NULL;

原因:连表的两个表的排序规则不一样,一个为utf8mb4_0900_ai_ci,另一个为:utf8mb4_general_ci

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值