Autor Beitrag
matze
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 4613
Erhaltene Danke: 24

XP home, prof
Delphi 2009 Prof,
BeitragVerfasst: Mi 14.07.10 21:40 
Hallo Leute,

Ich habe eine sehr ungewöhnliche Frage und zwar:
Ich habe in einer MySQL Tabelle Daten zu den Preisen von Flügen. Diese Daten werden mehrmals täglich abgefragt, sodass eine stattliche Menge zusammenkommt.
Es gibt pro Datensatz 3 Felder: Datum des Fluges, Datum der Abfrage, Preis des Fluges zum Zeitpunkt der Abfrage.

Sinn des Ganzen ist, herauszubekommen wie sich die Preise der Flüge verändern.

Die Daten liegen in einer Tabelle nun in der Form vor:

ausblenden Quelltext
1:
2:
3:
4:
5:
Abfrage    Flug    Preis
1.1.10    20.2.10    123
2.1.10    20.2.10    321
1.1.10    30.3.10    111
2.1.10    30.3.10    222


Das ganze soll aber nun in einer für Excel verwertbare Form gebracht werden also in die Spalten die Flüge und die Zeilen sollen die Abfragedaten sein:

ausblenden Quelltext
1:
2:
3:
        20.2.10    30.3.10
1.1.10    123      111
2.1.10    111      222

Die Frage nun:
Kann ich das direkt im Query machen, oder muss ich das später seperat in PHP (oder so) erzeugen? Vielleicht kann man das auch direkt in Excel umwandelt?

Danke schon mal für eure Hilfe!
Matze

_________________
In the beginning was the word.
And the word was content-type: text/plain.
BenBE
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 8721
Erhaltene Danke: 191

Win95, Win98SE, Win2K, WinXP
D1S, D3S, D4S, D5E, D6E, D7E, D9PE, D10E, D12P, DXEP, L0.9\FPC2.0
BeitragVerfasst: Mi 14.07.10 21:48 
Für PHP gibt es eine Reihe von Excel-Klassen, mit denen man direkt Excelsheets erzeugen kann.

Direkt in der Query wäre mir nichts bekannt ...

_________________
Anyone who is capable of being elected president should on no account be allowed to do the job.
Ich code EdgeMonkey - In dubio pro Setting.
Martok
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 3661
Erhaltene Danke: 604

Win 8.1, Win 10 x64
Pascal: Lazarus Snapshot, Delphi 7,2007; PHP, JS: WebStorm
BeitragVerfasst: Mi 14.07.10 22:24 
Du suchst nach Pivot Queries. Je nach DBMS geht das einfach oder schwierig.

Wobei Oracle ersteres, MySQL letzteres ist.

Aber: im CQT findet man was. Beziehungsweise eher so www.artfulsoftware.c....php?&bw=1052#77

_________________
"The phoenix's price isn't inevitable. It's not part of some deep balance built into the universe. It's just the parts of the game where you haven't figured out yet how to cheat."
matze Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 4613
Erhaltene Danke: 24

XP home, prof
Delphi 2009 Prof,
BeitragVerfasst: Do 15.07.10 09:16 
Ja genau. Das sind anscheinend Pivot Queries.
Aber da es von MySQL offensichtlich nicht wirklich komfortabel unterstützt wird, mache ich das wohl besser per Hand.

Ich glaube Excel kann direkt aus solchen Daten Pivot-Tabellen erzeugen oder?

_________________
In the beginning was the word.
And the word was content-type: text/plain.
Narses
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Administrator
Beiträge: 10183
Erhaltene Danke: 1256

W10ent
TP3 .. D7pro .. D10.2CE
BeitragVerfasst: Do 15.07.10 09:36 
Moin!

user profile iconmatze hat folgendes geschrieben Zum zitierten Posting springen:
Ich glaube Excel kann direkt aus solchen Daten Pivot-Tabellen erzeugen oder?
Ich würde sagen, ja. ;)

cu
Narses

_________________
There are 10 types of people - those who understand binary and those who don´t.
matze Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 4613
Erhaltene Danke: 24

XP home, prof
Delphi 2009 Prof,
BeitragVerfasst: Do 15.07.10 15:49 
Jup. Excel kann das recht komfortabel :-)

Danke an alle!

_________________
In the beginning was the word.
And the word was content-type: text/plain.