0

i have a table about product review. I saved data in table like this

 id| value|
___|______|
1  |Our pr|
2  |oduct |
3  |availa|
4  |ble in|
5  |all re|
6  |tailer|
7  |shop. |

I want dispaly in one row or paragraph like this Our product available in all retailer shop.

0

2 Answers 2

3

You will have to use GROUP_CONCAT as you want to combine data in separate rows.

Try this

SELECT GROUP_CONCAT(value SEPARATOR '') FROM yourtablename

Sign up to request clarification or add additional context in comments.

1 Comment

@user1464025 : If you think Junaid answered your question please mark it accepted. This is how SO works. See here, how to accept answer
0

try this:

mysql> set @a:=''

mysql> select @a:= concat (@a, ' ', value) from table1.

with that you'll have all the value in @a, and to display

mysql> select @a;

6 Comments

Wrong. With that you will just have one row at a time in @a
@tombom why you say that? can you tested and let me know your result?
How about you try it? CONCAT operates on rows, GROUP_CONCAT concatenates the strings in one group. Try your query with the test data from the question and you will get nothing but shop. Please edit your answer or delete it or prove me wrong.
And most important, make sure it's right before you post when you're not sure.
@tombom sqlfiddle.com/#!2/a2581/1262, I did another way to display the same result, those are options... please before to say 'edit or delete post' search a little bit about the different solution that a problem can have, if that example is not enough let me know and I'll send you "SQL variables for Dummies"
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.