Re: [Q] A simple SQL query, then why #$@&*%
Posted in 1995
I suggest you unload specific records from the databases
using the sql query that works (or something to reduce the number
of records), --
UNLOAD TO "employee.unl"
SELECT e.*
FROM employees e
WHERE e.fname MATCHES "Smith*";
UNLOAD TO "visitors.unl"
SELECT v.*
FROM visitors v
WHERE v.fname MATCHES "Smith*";
Then look at the unloads and compare the two fields to be sure you are
comparing apples to apples.
It may be one has leading zeros??
------------------------------------------------------------------------------
In article <488a8k$4c8@tin.monsanto.com>,
Saqib Mausoof <ssmaus@musctn.monsanto.com> wrote:
>I have a query that does a simple join, like
>
>SELECT e.lname, e.fname, v.vendor, v.empno, e.empno
>FROM employees e, visitors v
>WHERE e.empno = v.empno>
>NO rows are returned.
>
>If I change the WHERE CLAUSE to
>WHERE e.fname=v.fname or e.lname=v.lname
>
>I get the desired results. Now, data exists, both columns are CHAR, fname
>and empno are CHAR(25) and CHAR(10). They are both non-indexed and allow
>null vlaues. The only difference is that fname is first names and empno
>is social security number.
>
>I know that my queries don't work if
>WHERE empno="600987653", but works for
>WHERE empno=600987653
>
>Am I missing a simple SYNTAX. If they are both CHAR columns it should
>work. Call me stupid but please reply if you have any idea ;-)
>
>Thanks in advance.
>