thorwald
Goto Top

MS Access - Werte in mehreren Spalten zusammenfügen

Hallo Leute,

ich habe eine Access-Tabelle in der es (unter anderem) folgende Spalten gibt:

| Datum| Lieferant | Preis 1 | Preis 2 | Preis 3 | Preis 4 | Preis 5|

Ich möchte gerne eine Abfrage erstellen, in der alle Preise in einer Spalte aufgeführt werden:

| Datum| Lieferant | Preis 1 |
| Datum| Lieferant | Preis 2 |
| Datum| Lieferant | Preis 3 |
| Datum| Lieferant | Preis 4 |
| Datum| Lieferant | Preis 5 |

Wie kann das umgesetzt werden?

Gruß
Thorwald

Content-ID: 11169092825

Url: https://administrator.de/forum/ms-access-werte-in-mehreren-spalten-zusammenfuegen-11169092825.html

Ausgedruckt am: 14.03.2025 um 11:03 Uhr

em-pie
Lösung em-pie 13.11.2023 um 10:32:07 Uhr
Goto Top
Moin,

im schlimmsten Fall:

SELECT datum, lieferant, "Preis 1" AS preis WHERE "Preis 1" IS NOT null  
UNION ALL
SELECT datum, lieferant, "Preis 2" AS preis WHERE "Preis 2" IS NOT null  
UNION ALL
SELECT datum, lieferant, "Preis 3" AS preis WHERE "Preis 3" IS NOT null  
UNION ALL
SELECT datum, lieferant, "Preis 4" AS preis WHERE "Preis 4" IS NOT null  
UNION ALL
SELECT datum, lieferant, "Preis 5" AS preis WHERE "Preis 5" IS NOT null  
ukulele-7
ukulele-7 13.11.2023 um 10:44:37 Uhr
Goto Top
Oder UNPIVOT aber da Access ist die Lösung die selbe face-smile
https://stackoverflow.com/questions/7255423/how-to-simulate-unpivot-in-a ...
Thorwald
Thorwald 13.11.2023 um 17:12:15 Uhr
Goto Top
Vielen Dank für Eure Unterstützung: Es hat funktioniert face-smile