0

I'm new in SQL. I have three tables. TableA, TabelB and TableC. I have a request

SELECT a.Name, b.Value, c.Value
FROM dbo.TableA a
join dbo.TableB b ON a.Id=b.AValue
join dbo.TableC c ON b.Id=c.CValue
WHERE a.Object='ObjectName'

So I have a result like:

Name  |ValueB |Value
---------------------
MyName|MyValue|1Value 
---------------------
MyName|MyValue|2Value
---------------------
MyNaem|MyValue|3Value

So, how should I change request to get:

Name  |ValueB |Value |Value |Value
----------------------------------
MyName|MyValue|1Value|2Value|3Value

Is it possible?

Gleb
  • 1,412
  • 1
  • 23
  • 55
  • On what basis? You need to show some real values. – Raging Bull Apr 23 '14 at 08:44
  • 1
    You're asking for one ValueB columns and three Value columns, but from which tables are these Value columns? You need to be consistent with your names and show the structure of the tables. – Steve Pettifer Apr 23 '14 at 08:47
  • possible duplicate of [SQL Server PIVOT examples?](http://stackoverflow.com/questions/24470/sql-server-pivot-examples). In any case, you _are_ looking to do a `PIVOT`, of which there are a multitude of examples available. – Clockwork-Muse Apr 23 '14 at 10:25

0 Answers0