how can reporting in this Situation
Database
2
Posts
2
Posters
0
Views
1
Watching
-
please ignore my poor english... I Need Reporting This Table in this shape.plz help me... SQL Table ---------- City Value -- -- Londen 20 Tehran 12 Paris 15 Londen 12 My Needed Report ---------- Londen Tehran Paris ---- ---- ---- 32 12 15
You need to use SQL PIVOT: MSDN: Using PIVOT and UNPIVOT[^] Try:
SELECT
'TotalValue' AS Sum_Total_Values_By_City, [London], [Tehran], [Paris]
FROM
(SELECT City, Value
FROM MyTable) AS SourceTable
PIVOT
(
SUM(Value)
FOR City IN ([London], [Tehran], [Paris])
) AS PivotTableSandeep Mewara Microsoft ASP.NET MVP 2012 & 2013 [My Latest Article(s)]: How to extend a WPF Textbox to Custom Picker Server side Delimiters in ASP.NET