相同的SQL Query返回不同的结果

时间:2012-12-14 05:24:49

标签: oracle10g

我有这样的查询,

表格数据

PK    Fst_Name  Mid_Name Last_Name   Full_NAme 
---------------------------------------------------
1     Peter              Kisnan      Peter,Kisnan
2     Jeff      S        Boycott     Jeff,S,Boycott

select 1,PK,fst_name,Last_Name,Full_Name from A where PK=2
union
select 2, PK,fst_name,Last_Name,Full_Name from A where last_name='Kisnan' and fst_name='Peter'

结果

1,2,Jeff,Boycott, Jeff,S,Boycott
2,1,Jeff,Boycott, Jeff,S,Boycott

有人能回答这是怎么回事吗?我在Oracle 10g中使用

还查询

select count(1) from A where last_name='Kisnan' and fst_name='Peter' shows 2. but
select count(1) from A where last_name like'%Kisnan' and fst_name like'%Peter' shows 1. 

0 个答案:

没有答案