Hi,
I have a question that can we use a mysql query in Concat clause. I want to make a query like this

 SELECT CONCAT(AVG(value),'-',(select Count(UserId) as counts from user_details )) as `Average` from surveyuseranswer

Now I want to count number of users and concat it with the average value. My query runs but it returns me nothing. Can anyone help me that where I am wrong.
Thanks in advance.

I think you should be able to do that. Are you getting an error or just an empty resultset?

I am getting an empty result but no error.I wanted to know that why the result is coming empty because the result should not be empty as there I run the count query alone it displays me the count number.

What if you run the outer query alone without the inner query? Do you get results then?

SELECT AVG(value) as `Average` from surveyuseranswer
Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.18 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.