I have 2 table and I would like to get only unique rows from one those tables.
On the following example, I need the list of application_id which have no duplicate name.
Table appName
app_id | app_name |
---|---|
APP001 | a |
APP002 | b |
APP003 | c |
APP004 | d |
APP005 | f |
Table tbl_application_detail
app_id | em_id |
---|---|
APP002 | 2424 |
APP003 | 2424 |
Table that I expectation
app_id | app_name |
---|---|
APP001 | a |
APP004 | d |
APP005 | f |
I am new SQL I don’t know how make this code
SELECT application_id,application_name FROM appName
SELECT application_id,em_id FROM tbl_application_detail WHERE em_id=2424
2
Answers
On MySQL 8+, we can try using the following left anti-join approach:
Demo
You can try with Sub query (Mysql & SQL Sever) as well..
or
Joins (SQL Sever)
result