table_phone_type Here is an example code:

SELECT string_agg(CASE WHEN pc.id IS NULL THEN NULL ELSE concat(dic.lang_value1, ': ', pc.contact_value) END, ', ') AS "contacts" FROM tal_person person LEFT JOIN tal_dic_phone_type dic ON dic.id = pc.type_id 

the data is somehow duplicated

my request was to pull out only this data, that is, two entries

  • Transact? Postgre? (add tag) What exactly is duplicated (not clear on the screenshot)? - vp_arth
  • Base - inanimate. Like the request. They do not duplicate anything. You most likely have several entries with the same type_id in the tal_person table. - Alexander Belinsky
  • If lines are duplicated - add distinct to select - nick_n_a
  • yes in tal_person there is a type_id and there are a lot of them there. In table_phone_type there are only two types of mail and tel. each user has his own contacts, but the problem is that he has his own data, that is, mail and phone duplicates - ferma fermacom

0