A query or datatable is required to find the difference between two tables

asked 2021-04-21T17:58:36.64+00:00
AMER SAID 331 Reputation points

HI

I have a table between some products and another table with some products. I want to specify only the different products between the two tables.

table prod a --col prodnama
gh1
cd2
at3

table prodb --col prodnamb
at3
cd2

Result gh1

VB
VB
An object-oriented programming language developed by Microsoft that is implemented on the .NET Framework. Previously known as Visual Basic .NET.
1,825 questions
No comments
{count} votes

Accepted answer
  1. answered 2021-04-21T18:22:07.797+00:00
    Viorel 82,286 Reputation points

    If you need the names only, then check this query:

    (
        select prodnama from proda
        except
        select prodnamb from prodb
    )
    union all
    (
        select prodnamb from prodb
        except
        select prodnama from proda
    )
    
    No comments

0 additional answers

Sort by: Most helpful