SQL:1292截断不正确的DOUBLE值:' https://twitter.com/'

时间:2018-05-17 10:50:48

标签: php sql doctrine mariadb mysql-error-1292

我对MariaDB进行了非常简短的查询,以修复断开链接到Twitter。

表用户将link_twitter设置为VARCHAR(255),以生成我们使用PHP Doctrine的DB模式,但我想手动运行此查询。

服务器正在运行MariaDB 1.10

查询:

UPDATE
    `user` AS u
SET
    u.link_twitter = "https://twitter.com/" + u.link_twitter
WHERE
    u.link_twitter NOT LIKE 'https://twitter.com/%';

但是我收到了查询错误:(1292):截断了错误的DOUBLE值:' https://twitter.com/' '

我知道,这个问题在过去被问了很多,但没有一个解决方案适合我。 : - (

请问,我该如何解决?

由于

1 个答案:

答案 0 :(得分:2)

使用正确的字符串连接方法:

result_tuple = []

for description in description_list:
    # Find categories that satisfy the include condition
    categories_in = [cat[0] for cat in keyword_tuple if all([kw in description for kw in cat[1]['in']])]
    # Find categories that satisfy the exclude condition
    categories_out = [cat[0] for cat in keyword_tuple if all([kw not in description for kw in cat[1]['out']])]

    # Find the categories that satisfy both 
    # If there are multiple categories satisfying the condition, you need to come with a decision rule
    categories = list(set(categories_in).intersection(categories_out))

    # Append to the result list (Takes the first that is satisfied)
    if len(categories) > 0:
        category = categories[0]
    else:
        category = 'NO CATEGORY'

    result_tuple.append(description, category)

"ACS Tax Exemption", "Tax Exemption Expiry Date", "", "[ACS Tax Exemption] = 'N'" 表示在MariaDB / MySQL(以及大多数数据库)中添加。因此,它试图将其论点视为数字。