Quantcast
Channel: Transact-SQL forum
Viewing all articles
Browse latest Browse all 23857

GROUP BY to combine/concat a column

$
0
0

Hi,

SELECT         tblFuelCostDetails.TripId, tblFuelCostDetails.PurchaseDate,
                tblPetrolPumps.PumpName+CONVERT(nvarchar(50), tblFuelCostDetails.Quantity) as Pump
FROM           tblPetrolPumps INNER JOIN
               tblFuelCostDetails ON tblPetrolPumps.PumpId = tblFuelCostDetails.PumpId

Above query output is

TripId    PurchaseDate      Pump

74          2014-01-16          N.R120.00
73          2014-01-15          N.R10.00
73          2014-01-15          Masranga12.00

I would like to my output like

TripId    PurchaseDate      Pump

74          2014-01-16          N.R120.00
73          2014-01-15          N.R10.00,Masranga12.00

I find some example from internet where they give solution on a single table, but i could not make it when tables join together.







Viewing all articles
Browse latest Browse all 23857

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>