gpt4 book ai didi

mysql - 有什么办法可以在 SQL 中结合 LIKE 和 IN 吗?

转载 作者:行者123 更新时间:2023-12-01 00:11:19 28 4
gpt4 key购买 nike

<分区>

现在我有以下 SQL:

select MAX(score) as score, title from 
(
select 2 as score, title from tableName WHERE title LIKE '%railway employee%'
union
select 1 as score, title from tableName WHERE title LIKE '%railway%'
union
select 1 as score, title from tableName WHERE title LIKE '%employee%'
) as t1
group by title
order by score DESC

我希望能够做这样的事情:

select MAX(score) as score, title from 
(
select LEN(CurrentTerm) as score, title from tableName WHERE title LIKE IN ('%railway employee%', '%railway%', '%employee%')
) as t1
group by title
order by score DESC

CurrentTerm 将是匹配的术语,而不是表中的列。 SQL 中是否有任何类似的东西,特别是 MySQL?

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com