0

The issue is that I have each asset to have its tags, that is, number 6 to have 1,5 in a column, and asset 1 to have 1,3,5 PUTTING literally twice "asset_tag.tag_id" copies the same number of that row and separate it by comma

"image" is this CREATE VIEW image 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 ;

data: asest_id 1 1 1 6 6

tag_id 1 3 5 1 2

That is shown in tag_id 1,3,5 for asset_id 1 , and in the case of asset_id 6 that 1,2 come out

the data is of type integer

I have to get through a subquery but I don't see it,

enter image description herei want taht the group "6" have "5,1" , el "1" have "1,3,5" , what i`m doing wrong?

i see this : Sql select group by and string concat

and mine enter image description here

10
  • 1
    Try using GROUP_CONCAT. Ref: dev.mysql.com/doc/refman/8.0/en/… Commented Sep 29, 2022 at 7:50
  • THANKS , but i have and error , the function don`t exists Commented Sep 29, 2022 at 9:30
  • Can you translate the above error, sorry I can't read it. Commented Sep 29, 2022 at 9:37
  • there is no function group_concat(integer) line 2: hint: no function matches on the name and types of arguments. it may be necessary to add explicit type conversion Commented Sep 29, 2022 at 9:50
  • The linked question is for MS SQL Server, while this question is tagged with mysql. Which one do you use? Group_concat is available in mysql, but is not available in MS SQL Server. Commented Sep 29, 2022 at 10:06

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.