Need help with a sub query:

hello, i need help writing a sub query... i have 2 tables, tab1 has 600 rows and tab2 has 271 rows so i need minus tab2 rows from tab1 and display the remaining 329 rows...
tab1 has 8 columns of which i need to display all rows, tab2 has 10 columns of which 6 column match  6 columns on i wrote something like this and it does not work...

select col1, col2, col3, col4, col5, col6, col7, col8, col8
from tab1 t1
where t1.col1 not in  (select       t2.col1
               from       tab1 t2, tab2 t3
                where       t2.col1=t3.col1 and
                                                   t2.col2=t3.col2 and
                                                  t2.col3=t3.col3 and
                               t2.col4=t3.col4 and

can you please help me with this sub query...
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Why do not you try

select wanted columns
select common_columns from tab1
select common_columns from tab2
) a, tab1
where your join condition
slightwv (䄆 Netminder) Commented:
Maybe something like this?

select col1, col2, col3, col4, col5, col6, col7, col8 from tab1
where (col1, col2, col3, col4, col5,col6) in (
      select col1, col2, col3, col4, col5, col6 from tab2

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Rao_SAuthor Commented:
thank you both very much, i tried the one suggested by slightwv, this worked...
slightwv (䄆 Netminder) Commented:
oops.  I think mine should be NOT IN instead of IN.

... ,col6) NOT in (
      select ...
Rao_SAuthor Commented:
yes, that is right, i tried with the 'NOT IN' it worked..
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Oracle Database

From novice to tech pro — start learning today.