我需要从表格中获取与给定地图名称匹配的所有记录,以及在给定名称后以 [>继续的记录 我试过这样做:
SELECT route FROM table WHERE route REGEXP 'map_name1|map_name2'
问题是,如果存在名称如 map_name1_version2 的地图,它也会返回该地图,但它只需返回例如 map_name1 和 map_name1 [路线]
编辑:
像这样完成
SELECT route FROM table WHERE route REGEXP '^map_name1$|mapname1\\[|^map_name2$|mapname2\\['
答案 0 :(得分:0)
以这种方式使用LIKE:
SELECT route FROM table WHERE route LIKE "map_name1" OR route LIKE "map_name1%" ;
OR
SELECT route FROM table WHERE route LIKE "map_name1" OR LIKE "map_name1" AND route LIKE "%map_name2%" ;