Re: SQL Query
Posted in 1991
>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.
>
>This is very important. If there is no simplest way I can do such query then
>any other suggestions are welcome.
>
>Thanks. Ruchi.
Yep, it's even simple to do (once you know how):
select project_no
from table_a
where project_no not in
(select project_no
from table_b)
This will give you the single row corresponding to project_no 2 in table_a.
jeffl
----
Jeffrey F. Lawhorn Information Systems Group
Programming Manager Unix, C, and Database Consulting
jfl0@isg.com 450 B Street 16th Floor
sdsu!isg100!jfl0 San Diego, CA 92101 (619) 234-3405 x274