Re: SQL Query
Posted in 1991
RUCHI@CFRVM.CFR.USF.edu writes:
> I have two tables that joines them by project_no. Following are two tables
> with its values.
>
> TABLE A TABLE B
> -----------------------
> project_no project_no
> ________________________
> 1 1
> 2 -
> 3 3
>
> When I user outer join then it says that it found 3 rows which is correct.
> But is there anyway I can do my query to find the project_no from TABLE A
> that is not in the TABLE B? So, my result should say only one row found
> from TABLE A.
How 'bout
select project_no
from table_a
where project_no not in
(
select project_no
from table_b
where project_no is not null
);
or
where project_no != "-"
in the sub-query, if that really is a dash.
I had hours of fun with a table where some of the blanks were NULLs,
and some of the blanks where whitespace, if you see what I mean ...
Hope this helps.
Cheers - Tony.
_______________________________________________________________________________
Tony Heskett th@bnr.co.uk |Voice: (+44) 279 429531 x 2637
BNR, London Road, Harlow, Essex, CM17 9NA |Fax: (+44) 279 454187