1

在我的mysql表中,字段值如下:

    table name - "clients"                        
    field name - "accent"   
    values are - "Eastern(Northern,Southern),Scottish(East Coast)"
                 "Eastern(South,North,Southern),Scottish(East Coast)"

如果我给
select accent from clients where accent like '%north%'

如果超过 100 条记录的顺序不同。括号中的字符串的顺序不同。

它将给出以上两个值。我应该如何获得第二个值?

请帮助我,谢谢。

4

3 回答 3

0

Try this

select accent from clients where accent like '%North,%'

Update:

If you want to select only North not Northern then try this

select accent from clients where accent like '%North%' and accent not like '%Northern%'

If you want only Northern value then try this

select accent from clients where accent like '%Northern%'

hope this solves your problem.

于 2013-11-07T08:43:26.420 回答
0

Try this:

select accent from clients where accent regexp 'North[^a-z]'

The regex means match all that contains 'North' and its not followed by other letters

于 2013-11-07T08:45:45.443 回答
0

您可以使用偏移属性。

select accent from clients where accent like '%north%' limit 1 offset 1

其中 limit 意味着您将只检索一条记录,而 offset 意味着从第二项开始。

于 2013-11-07T09:03:17.113 回答