我有以下表格
http://sqlfiddle.com/#!2/647e9
如何选择 concat 显示如下
期望的结果:
+---------+-----------+---------------+---------------------------------+
| Origin | Stock | Farm Title | Farm Values |
+---------+-----------+---------------+---------------------------------+
| US | P1 | Perdue | 333 |
| US | P3 | Holstein | 825 |
| CA | Q4 | FarmOne | 455,536,617,698,779,860 |
| CA | Q4 | Beef Farm | 540,550,560,570,580,590 |
| CA | Q4 | CattleOne | 1080,1100,1120,1140,1160,1180 |
| MX | B3 | Cow Mill | 11 |
| MX | B3 | Dotterers | 98 |
| MX | B3 | AgriZone | 202 |
+---------+-----------+---------------+---------------------------------+
我试过了
Select
ORIGIN_NAME
STOCK_TITLE
FARM_TITLE
concat(FARM_VALUES, ",")
From Farm f
JOIN STOCK s on S.S_ID=f.S_ID
JOIN ORIGIN o on o.ORI_ID=s.ORI_ID