当前我的查询如下:
SELECT *
FROM suppliers s
INNER JOIN supplier_addresses a
ON s.id = a.supplier_id
在supplier_addresses
中有一个名为address
的字段,我想用字符长度大于10的地址过滤上面的查询结果?
我尝试将where LEN(a.address) > 10
添加到上面的查询中,但工作量很大。
答案 0 :(得分:1)
您的查询应为:
SELECT * FROM suppliers s
INNER JOIN supplier_addresses a
ON (s.supplier_id = a.supplier_id)
WHERE LENGTH(a.address)>10;
答案 1 :(得分:1)
它应该像这样:
SELECT *
FROM suppliers s
INNER JOIN supplier_addresses a
ON s.id = a.supplier_id
WHERE char_length(a.address) > 10