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-Key: 11169092825

Url: https://administrator.de/contentid/11169092825

Printed on: April 27, 2024 at 10:04 o'clock

Member: em-pie
Solution em-pie Nov 13, 2023 at 09:32:07 (UTC)
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  
Member: ukulele-7
ukulele-7 Nov 13, 2023 at 09:44:37 (UTC)
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 ...
Member: Thorwald
Thorwald Nov 13, 2023 at 16:12:15 (UTC)
Goto Top
Vielen Dank für Eure Unterstützung: Es hat funktioniert face-smile