3

我有一个姓氏和名字的人表。

考虑以下记录,其中

FirstName == 'Pete' 和 LastName == 'Aaaa'

当我运行以下选择语句时:

select * from Person where FirstName='Pete' and LastName like 'a%' -- 0 record returned
select * from Person where FirstName='Pete' and LastName like 'aa%' -- 1 record returned
select * from Person where FirstName='Pete' and LastName like 'aaa%' -- 0 record returned
select * from Person where FirstName='Pete' and LastName like 'aaaa%' -- 1 record returned

当我在 SQL Fiddle 中运行它时 - 为每个选择返回 1 条记录,因为它应该SQL Fiddle 查询

有人有什么想法吗?

4

1 回答 1

2

尝试这个

select * from Person where FirstName='Pete' and LastName collate Latin1_General_CI_AS like 'a%'
select * from Person where FirstName='Pete' and LastName collate Latin1_General_CI_AS like 'aa%'
select * from Person where FirstName='Pete' and LastName collate Latin1_General_CI_AS like 'aaa%'
select * from Person where FirstName='Pete' and LastName collate Latin1_General_CI_AS like 'aaaa%'
于 2012-11-09T12:25:21.777 回答