Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8306827
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T18:24:29+00:00 2026-06-08T18:24:29+00:00

I have (Table1.column1 and Table1.column2) and another (Table2.column1 and Table2.column2) in my db and

  • 0

I have (Table1.column1 and Table1.column2) and another (Table2.column1 and Table2.column2) in my db and i wanna get result where (Table1.column1 and Table1.column2) values not found in (Table2.column1 and Table2.column2)?

Table1                          Table2
------------------------        ------------------------
 sid   sname    sclass            rid  rname    rclass
------------------------        ------------------------
| 1 | glass  | a class |        | 1 | glass  | b class |
| 2 | glass  | c class |        | 2 | glass  | c class |
| 3 | ice    | a class |        | 3 | ice    | b class |
| 4 | ice    | b class |        | 4 | ice    | c class |
| 5 | fridge | a class |        | 5 | fridge | a class |
| 5 | fridge | b class |        | 5 | fridge | c class |
------------------------        ------------------------

The result should be :

Result Table
------------------------
 sid   sname    sclass 
------------------------
| 1 | glass  | a class |
| 3 | ice    | a class |
| 5 | fridge | b class |
------------------------

As I mentioned above, this is similar to the contains method but i`m going to use this SQL string in VB6.

There are classes a,b and c. Every item such as (glass, fridge, etc.) can contain any of these classes so any combination of table2 should not exist in my result.

I want to do it with sql query which is like:

SELECT * 
  FROM area1 AS table1,
       (SELECT * FROM area2 WHERE blablabla..) AS table2
 WHERE table1.SNAME = table2.RNAME
   AND table1.sclass <> table2.rclass
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T18:24:30+00:00Added an answer on June 8, 2026 at 6:24 pm

    You need a left join

    SELECT sid, sname, sclass
    FROM table1
        LEFT JOIN table2
        ON table1.sname=table2.rname
        AND table1.sclass=table2.rclass
    WHERE rid is null
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a table say table1 which has 3 columns column1, column2 and column3
I have a table (Table1) which has a composite primary key(Column1 + Column2). I
I have table1 with columns: def_id, def_name, username etc I have another table table2
Suppose I have one table table1 and another table table2. Both has same column
I have table A with five rows and the following values: Column1 Column2 Column3
i have table structure with 3 colums (column1, column2, column3) and i want to
I have two columns(column1, column2) in my oracle database table named as demo .
In my table accounts I have four columns like user, pass, column1, column2 I
Im using SQL Server 2005. I have a table1 with 3 columns. And table2
I have two tables - table1 and table2 table1 has 14 columns and table2

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.