Hi!
I have:
table mytable:
id, name, property
1, admin, admin area
1, admin, template area
1, admin, resource area
2, designer1, template area
2, designer1, resource area
3, publisher, null
4, designer2, template area
4, designer2, admin area
I know this is not relational but I used a table join. I didn’t show it here for simplicity.
I want to do something like this:
1, admin, admin area + template area + resource area
2, designer1, template area + resource area
3, publisher, null
4, designer2, templatea area + admin area
- How do I concatenate rows in SQL? (It seems difficult, for I have googled (It is ok, since I managed to do it in Java, inefficient, though))
- More importantly: How do I set the limit so that the rows I get back is distinct rows is more than the actual rows because of the duplicates? For example: if I limit to 2, I do not get only id = 1. I get id = 1 and 2.
I have tried:
SELECT * FROM mytable IN (SELECT * FROM (SELECT DISTINCT id FROM mytable LIMIT 0, 2) alias)
but it doesn’t work. Please help. Thanks.