Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7421659
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T08:26:56+00:00 2026-05-29T08:26:56+00:00

Is it possible to echo inside a MySQL statement? For example: SELECT p.ID,p.post_title,p.guid,p.post_name,p.post_status,name,taxonomy, <?php

  • 0

Is it possible to echo inside a MySQL statement?

For example:

SELECT
p.ID,p.post_title,p.guid,p.post_name,p.post_status,name,taxonomy,
<?php echo "TEXT HERE"?> GROUP_CONCAT(DISTINCT name ORDER BY name DESC SEPARATOR '|') AS 'tags',

Is this possible to get this result {tag1|tag2|tag3} ?

  • 1 1 Answer
  • 1 View
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T08:26:57+00:00Added an answer on May 29, 2026 at 8:26 am

    It sounds like this question might be relevant. However this should do what you want:

    -- Table structure:
    -- post(_id_), tag (_id_, tag), post_tag(post*, tag*)
    
    SELECT post.id,
        CONCAT('{', GROUP_CONCAT(distinct tag.tag order by tag.tag separator '}{'), '}') AS tags
    FROM post
    JOIN post_tag ON post.id = post_tag.post
    JOIN tag ON post_tag.tag = tag.id
    GROUP BY post.id
    

    Which returns:

    +----+--------+
    | id | tags   |
    +----+--------+
    |  1 | {A}{B} |
    |  2 | {B}{C} |
    |  3 | {C}    |
    +----+--------+
    

    Make sure to include the GROUP BY clause. I did add foreign key references but I’m unsure whether MySQL actually uses them for this.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is it possible to call javascript inside a shell script? For example, echo Content-type:
Possible Duplicate: Reference: Comparing PHP's print and echo Is there any major and fundamental
I tried to put an if statement inside an echo but this parse error
Is it possible to put a table class in php, like this: echo <table
How can I put a php statement between quotes, inside php? I want to
Possible Duplicate: How are echo and print different in PHP? UPDATE : I found
Is it possible? function test() { echo function name is test; }
I am wanting to find out if the following is possible with PHP inside
I am aware that it is not possible to echo the * while you
I am new to object php, I have the following concern: is it possible

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.