HI,
I have a table with three columns id,history_nr,value. Now I want to make a query that should concat value with different nr. I have tried this syntax but it is not working.

SELECT CONCAT((SELECT value FROM table WHERE history_nr=63 and id=1),'',(SELECT value FROM table WHERE history_nr=803 and id=1)) FROM table WHERE id=1

but this code is not working. Can anyone help that where the issue is.
Thanks in advance

Recommended Answers

All 3 Replies

Try:

SELECT GROUP_CONCAT(value)
FROM table
WHERE id = 1
AND history_nr IN (63, 803)
GROUP BY id

The data that is to be displayed is height like 5ft 2 in.How can I show this using group concat

Be a part of the DaniWeb community

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