I am trying to get a single description column from a reference table in PostgreSQL using 3 id columns as a concatenated value.
I have a id Table as below:
+-----+-----+-----+
| id1 | id2 | id3 |
+-----+-----+-----+
|   1 |   2 |   3 |
|   4 |   6 |   5 |
+-----+-----+-----+
and Reference Table;
+----+----------+
| id |   desc   |
+----+----------+
|  1 | apple    |
|  2 | boy      |
|  3 | cat      |
|  4 | dog      |
|  5 | elephant |
|  6 | Flight   |
+----+----------+
The Desired expected output is as below
I just have to concat a "/M" in the end additionally.
I don't have to add /M if id2 and id3 both are null
+-----------------------+
|         desc          |
+-----------------------+
| apple+boy+cat/M       |
| dog+Flight+Elephant/M |
+-----------------------+
