Subject | Re: Simple sql ,what's wrong? |
---|---|
Author | Svein Erling Tysvær |
Post date | 2006-02-10T14:58:57Z |
If the phone fields are identical (NULLs aren't identical), then
records should be returned. Try
select 'x'||a.PHONE||'x' from tb1 a
and
select 'x'||a.PHONE||'x' from tb2 b
just to eliminate that it is something stupid like one of the tables
containing spaces. I must admit that I've never tried using different
character sets, maybe that could influence Firebird? But I guess phone
contains numbers and they are pretty similar in most languages.
Your SQL seems OK to be, I would of course recommend using SQL-92 and
not SQL-89 and rewrite your query to
select a.PHONE,a.content from tb1 a join tb2 b on a.phone=b.phone;
but your sql should work.
Set
records should be returned. Try
select 'x'||a.PHONE||'x' from tb1 a
and
select 'x'||a.PHONE||'x' from tb2 b
just to eliminate that it is something stupid like one of the tables
containing spaces. I must admit that I've never tried using different
character sets, maybe that could influence Firebird? But I guess phone
contains numbers and they are pretty similar in most languages.
Your SQL seems OK to be, I would of course recommend using SQL-92 and
not SQL-89 and rewrite your query to
select a.PHONE,a.content from tb1 a join tb2 b on a.phone=b.phone;
but your sql should work.
Set
--- In firebird-support@yahoogroups.com, "tailuo2002" wrote:
> The sql below doesn't return any row:
>
> select a.PHONE,a.content from tb1 a,tb2 b where a.phone=b.phone;
>
> But tb1 and tb2 has the same PHONE structure and many PHONE data are
> same.
>
>
> tb1 structure:
> ...
> phone varchar(18) nullable
> ...
>
> tb2 structure:
> ...
> phone varchar(18) nullable
> ...
>
> Thank you.