2016-05-17 6 views
0

Ich habe eine Tabelle wie diese:ACCESS: Umstellen Abfrageergebnisse

table 1

Und würde es so neu zu ordnen mag:

tabe 2

Ist dies möglich mit SQL-Code?

+1

Check [hier] (http://stackoverflow.com/questions/15137992/access-sql-with-pivot) und [hier] (https://msdn.microsoft .com/de-us/library/office/bb208956 (v = Büro.12) .aspx) – BJones

Antwort

1

HIER IST

SELECT PRODUCT , [2015] SALES2015,[2016] SALES2016 
FROM YOUR_TABLE X 
PIVOT 
(SUM(sales) 
FOR 
[year] IN ([2015], [2016]) 
)PV 
+1

Ich denke, Sie brauchen ['TRANSFORM'] (https://msdn.microsoft.com/en-us/library/office /bb208956(v=office.12).aspx) für Access. – BJones