使用连接查询创建多个标头

时间:2014-02-12 13:26:51

标签: sql header

我的疑问是:

SELECT
  r.ArtNr AS ArtNr,
  GROUP_CONCAT(CONCAT(m.HKZ, " - ", r.RefNr)) AS RefNr
FROM reference_numbers r
LEFT JOIN manufacturer m 
       ON r.KHerNr = m.HerNr
LEFT JOIN supplier_main_address s 
       ON r.DLNr = s.DLNr
LEFT JOIN article_to_generic_article_allocation a 
       ON r.ArtNr = a.ArtNr
LEFT JOIN generic_articles g 
       ON a.GenArtNr = g.GenArtNr
LEFT JOIN language_descriptions l 
       ON g.BezNr = l.BezNr AND l.SprachNr = 4
WHERE r.ArtNr = 'ADA104201'

我的输出是:

ArtNr      |        RefNr 

ADA104201 | CHRYS - 05017843AA,CHRYS - 05017857AA,CHRYS - 05083853AA,CHRYS - 05083853AB,PAGID - T5144,BOSCH - 0 986 494 029,BOSCH - 0 986 424 586,TEXTAR - 2353202,JURID - 573033J,BENDIX - 573033B,MAG - 363700205144,MAG - 363702161337,MIN - MDB2082,QUINTON HA - BP1257,INT - QP704-02060,INT - QP704-02060X,TRW - GDB4118,BREMBO - P 11 012,FERODO - FDB1442,ZIMMERMANN - 23532.200.1,FTE - BL1787U2,TRISCAN - 8110 10522,PEX - 7.849,PEX - 7.849S,DELPHI - LP1522,METZGER - 0753.02,ROULUNDS - 813981,METELLI - 22-0521-0,NK - 229316,OPTIMAL - 12089,REMSA - 0753.02,ROADHOUS - 2753.02,JAPANPAR - PA-094AF,ICER - 181378,ICER - 181378-701,QH INTERNA - HP7322,QH INTERNA - 7322,TRUSTING - 537,TRUSTING - 537.0,ASHIKA - 50-00-094,BRAKE ENG - PA1330,APEC - PAD 1118,GIRLING - 6141181,BRECK - 23532 00 C,KAWE - 85116,KAWE - 0753 02,FRITECH - 537.0,FRITECH - 537,SBS - 1501229316,CIFAM - 822-521-0,WOKING - P6533.02,VILLAR - 626.1061,RAICAM - 721 0,FI.DI./ADL - D10045,FIRST LINE - FBP3353,COMLINE - CBP3894,IPS PARTS - IBD-1094,JAPKO - 50094,ABE - C1Y0

我希望每个refnrs都有单独的标题(I:E逗号分隔),这可能吗?

提前致谢。

的Nik

0 个答案:

没有答案