mysql中可以查询英文却查不了中文的数据

mysql中可以查询英文却查不了中文的数据,第1张

这种情况大多数是编码不统一造成的,数据库建表时和 查询传入的参数都用GBK就好了

mysql>SELECT * FROM `har_data`.`month_detail` where employee_status like '%休假

%'

+-----------------+-------------+-----------+------------+----------+----------

+-------------------+-----------------+

| monthdetail_key | employee_id | date_year | date_month | date_day | date_type

| employee_worktime | employee_status |

+-----------------+-------------+-----------+------------+----------+----------

+-------------------+-----------------+

|6217 | 1933 | 2012 | 12 |3 | 平日

| - | 年休假 |

|6218 | 1933 | 2012 | 12 |4 | 平日

| - | 年休假 |

用正则表达式来判断,示例SQL代码如下:select username from user where not(username regexp "[\u0391-\uFFE5]")这个正则表达式就能判断出来了。


欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/zaji/8350257.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-04-15
下一篇 2023-04-15

发表评论

登录后才能评论

评论列表(0条)

保存