-5

I have two tables with following values:

User Name;User Number;Position No; Position Desc;Role;Role Description;User Type;User Lock Status;End Date; Single or Composite;Start Date; End Date; Date;Time.

I want to compare both the tables and would like the query to display only

Name;User Number;Position No; Position Desc;Role;Role Description;User Type;User Lock Status;End Date; Single or Composite;Start Date; End Date; Date;Time.

For User Number IF the value in 'Role' is different.

yacc
  • 2,915
  • 4
  • 19
  • 33
  • 1
    did you try anything? this is an easy join – Hogan Nov 19 '17 at 01:46
  • 1
    Can you write a query that returns the rows from table `one` no matter what rows are contained in table `two`? Do you have *any* SQL written? Do you realize that the SQL statement will start with `SELECT` keyword and include a `FROM` clause? This question doesn't show much effort in terms of developing a query, showing example data, or expected output. Not much of a specification other than listing some names of columns in some tables that we are left to guess at ... table "one" and table "two"? https://stackoverflow.com/help/asking. – spencer7593 Nov 19 '17 at 01:57
  • Possible duplicate of [Finding duplicate values in a SQL table](https://stackoverflow.com/questions/2594829/finding-duplicate-values-in-a-sql-table) – sam7 Nov 19 '17 at 04:38

1 Answers1

1
SELECT
    [whatever columns you want]
FROM
    Table1
    INNER JOIN Table1 ON Table1.UserNumber = Table2.UserNumber
WHERE
    Table1.Role != Table2.Role
Alan
  • 1,378
  • 2
  • 19
  • 24