search

Home  >  Q&A  >  body text

Can mysql extract two fields to combine?

It is necessary to extract the contents of two fields in mysql, one is the keyword, and the other is the link corresponding to the keyword
Is there any way to extract and combine them?
Duplication also needs to be removed, because the keywords in mysql are duplicated with the corresponding links

< /p>

Achieve the following effects

<a href="Link corresponding to the keyword">Keyword</>
伊谢尔伦伊谢尔伦2800 days ago466

reply all(2)I'll reply

  • 淡淡烟草味

    淡淡烟草味2017-05-16 13:07:40

    You need to use mysql's concat function and deduplication function distinct. Refer to the sql statement below!

    select distinct concat('<a href="',`description`,'">',`title`,'</a>') as rs from `xxx`

    reply
    0
  • 为情所困

    为情所困2017-05-16 13:07:40

    Direct

    SELECT DISTINCT `title`, `description` FROM `xxx`

    That’s it

    reply
    0
  • Cancelreply