-1

I have 3 tables like

TAB_1

ID NUMBER
1 101
2 102
3 103
4 104
5 105
6 106
7 107
8 108
9 109
10 110

TAB_2

ID NUMBER
1 101
2 102
3 105

TAB_3

ID NUMBER
1 104
2 107
3 110

The output needs to be:

ID NUMBER
1 103
2 106
3 108
4 109
philipxy
  • 14,867
  • 6
  • 39
  • 83
  • You need to union the TAB_2 and TAB_3 that result will be LEFT join with TAB_1 – Arulkumar Jul 07 '22 at 12:18
  • Why are the ids in the results different from table1? – MatBailie Jul 07 '22 at 14:01
  • [How do I ask and answer homework questions?](https://meta.stackoverflow.com/q/334822/3404097) [How much research effort is expected of Stack Overflow users?](https://meta.stackoverflow.com/q/261592/3404097) [ask] [Help] [mre] PS [Is there any rule of thumb to construct SQL query from a human-readable description?](https://stackoverflow.com/a/33952141/3404097) – philipxy Jul 07 '22 at 17:41

1 Answers1

1

I think u can use NOT IN with Subqueries

Like;

SELECT
    *
FROM
    Table_1
WHERE
    Number NOT IN (Select number from Table_2) and
    Number NOT IN (Select number from Table_3)

  • Please use standard spelling & punctuation. Also code-only answers are poor. Explain how your post answers the question. Repeating code in prose doesn't explain it. PS Usually "I think" means "I am not sure", ie it means "I don't think". [answer] [Help] – philipxy Jul 07 '22 at 14:06