我有一个包含LastName和FirstName的Person表。
考虑以下记录
FirstName =='Pete'和LastName =='Aaaa'
当我运行以下select语句时:
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 query
有人有什么想法吗?
答案 0 :(得分: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%'