-5

I have two tables (Leave_type and Employee_meta) How can I display all records from two tables but exclude some records?

table: Leave_type

+-------+---------------+
|  id   | Leave_name    |
+-------+---------------+
|  1    | ANNUAL LEAVE  | 
|  2    | SICK          | 
|  3    | UNPAID LEAVE  |
|  4    | PUBLIC HOLIDAY|
+-------+---------------+

table: Employee_meta

+--------+---------------+----------------+
|user_id|  firstname     | leave_type_ids |
+--------+---------------+----------------+
|  1     |   Muhd        |1,2,4           |
+--------+---------------+----------------+

This is I want Output:

+-------+----------+------------------------------------+
|user_id| name     | Leave Type                         |
+-------+----------+------------------------------------+
|  1    | Muhd     | ANNUAL LEAVE , SICK, PUBLIC HOLIDAY|
+-------+----------+------------+-----------------------+

I want to display records from these two tables with the first name and Leave Type.

Thank you in advance :)

Ainz
  • 341
  • 2
  • 12
  • 2
    Is storing a delimited list in a database column really that bad? [**TL;DR - YES it is**"](https://stackoverflow.com/questions/3653462/is-storing-a-delimited-list-in-a-database-column-really-that-bad) Look up [Cross Reference/Link Tables](https://www.plus2net.com/sql_tutorial/sql_linking_table.php) – RiggsFolly May 31 '22 at 05:53

0 Answers0