The point is that I have each asset to have its labels, that is, number 6 to have in a column 1,5
, and asset 1 to have 1,3,5
. Putting literally twice asset_tag.tag_id
copies the same number from that row and separates it by a comma.
"image" is this:
CREATE VIEW imagen as
SELECT asset_tag.asset_id FROM asset_tag GROUP BY asset_tag.asset_id ;
SELECT asset_tag.asset_id, concat_ws(',',asset_tag.tag_id,asset_tag.tag_id) AS etiqueta
FROM public.asset_tag
-- JOIN PUBLIC.imagen ON asset_tag.asset_id = imagen.asset_id
-- WHERE imagen.asset_id = asset_tag.asset_id
GROUP BY asset_tag.asset_id,asset_tag.tag_id
-- HAVING asset_tag.asset_id = imagen.asset_id
;
asest_id 1 1 1 6 6
tag_id 1 3 5 1 2
Let it show in tag_id 1,3,5
for asset_id 1 , and in the case of asset_id 6 let it come out 1,2
.
The data is of type integer.
I have to get through a subquery but I don't see it.