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

  • SEARCH
  • Home
  • 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 8339229
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T04:49:45+00:00 2026-06-09T04:49:45+00:00

I just added a table which holds a url and description for each item

  • 0

I just added a table which holds a url and description for each item in place. The below query works ok … but it’s only returning the url and I need the desc also. I m not sure how to make this work.

$query_str = "SELECT      a.userid, a.cat, a.id, a.name, a.image, 
                          a.desc, a.country, b.user_id, c.username, 
                          c.fbook, d.cat_id,
                          (
                               SELECT GROUP_CONCAT(url) 
                               FROM one_add o 
                               WHERE a.id=o.one_id

                          ) AS url,
                          (
                               SELECT COUNT(id) 
                               FROM one_msg m 
                               WHERE m.guest_id = ? AND 
                                     m.one_id=a.id 
                          ) AS count
               FROM place a
                            LEFT OUTER JOIN wait b 
                                 ON a.id=b.post_id AND 
                                    b.user_id= ?
                            JOIN users c
                                 ON a.userid=c.id
                            LEFT JOIN ( 
                                       SELECT userid, user_id, 
                                              GROUP_CONCAT( cat_id ) AS cat_id 
                                       FROM user_cat 
                                       WHERE userid='$user_id' 
                                       GROUP BY user_id 
                                      ) AS d ON d.userid='$user_id' AND 
                                                d.user_id=a.userid
              WHERE a.cat != ? ORDER BY a.date desc";

This is what I want to accomplish: <a href="url">desc</a>

  • 1 1 Answer
  • 0 Views
  • 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-06-09T04:49:46+00:00Added an answer on June 9, 2026 at 4:49 am

    You can achibe this by using CONCAT inside GROUP_CONCAT function as:

    (SELECT GROUP_CONCAT(CONCAT('<a href=\"',url,'\">',desc,'</a>')) 
     FROM one_add o 
     WHERE a.id=o.one_id) AS url
    

    full query:

    (SELECT COUNT(id) FROM one_msg m WHERE m.guest_id = ? AND m.one_id=a.id ) AS count
    FROM place a
    LEFT OUTER JOIN wait b ON a.id=b.post_id AND b.user_id= ?
    JOIN users c ON a.userid=c.id
    LEFT JOIN ( SELECT userid, user_id, GROUP_CONCAT( cat_id ) AS cat_id FROM user_cat WHERE userid='$user_id' GROUP BY user_id ) AS d ON d.userid='$user_id' AND d.user_id=a.userid
    WHERE a.cat != ? ORDER BY a.date desc";
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have to take a value from one table which I have just added
I just added a new column to a table which has over 1000 rows
I just added this to my web.xml on my JBOSS server. But it had
I just added adds to my app, but the moment i run it i
I have just added a product and everything works fine. The product is a
I have just added a null password field to a mysql table using this
I just added a newly created SP to my project which unfortunately required a
I have a mysql table which will store users email addresses (each is unique
I have a table which can have rows and columns added to and removed
Ok so this is the query I have...I just added the ACCOUNTID and the

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.