我有以下查询:
SELECT
*
FROM
`Magic The Gathering`
WHERE
`set` = 'Magic 2013'
ORDER BY
(CASE
WHEN `cost` LIKE '%B%' THEN 1
WHEN `cost` LIKE '%R%' THEN 2
WHEN `cost` LIKE '%G%' THEN 3
WHEN `cost` LIKE '%W%' THEN 4
WHEN `cost` LIKE '%U%' THEN 5
WHEN `cost` LIKE '%B%U%' THEN 6
ELSE 7
END),
FIELD (`rarity`, 'Mythic', 'Rare', 'Uncommon', 'Common', 'Land') ASC,
(CASE
WHEN `type` LIKE '%Planeswalker%' THEN 1
WHEN `type` LIKE '%Creature%' THEN 2
WHEN `type` LIKE '%Instant%' THEN 3
WHEN `type` LIKE '%Sorcery%' THEN 4
WHEN `type` LIKE '%Enchantment%' THEN 5
WHEN `type` LIKE '%Artifact%' THEN 6
WHEN `type` LIKE '%Land%' THEN 7
END)
LIMIT
500
如果你看线...
WHEN `cost` LIKE '%B%U%' THEN 6
我怎样才能使它支持两者
WHEN `cost` LIKE '%B%U%' THEN 6
和
WHEN `cost` LIKE '%U%B%' THEN 6
注意 U 现在在 B 前面。或者甚至是一个变体,例如......
WHEN `cost` LIKE '%B%U%G%R%' THEN 6
基本上,如果这些字符中的任何一个无论顺序如何都在字符串中,它应该可以工作。我怎样才能做到这一点?