MySQL Forums
Forum List  »  German

Komplexe Abfrage
Posted by: Oliver Wagner
Date: July 18, 2018 11:48PM

Hallo zusammen,

folgendes Problem:
in einer Tabelle gibt es die Spalten id, tour und anschrift.
1 1 Anschrift 1
2 2 Anschrift 2
3 3 Anschrift 3
4 1 Anschrift 4
5 1 Anschrift 5
6 2 Anschrift 6

Jetzt brauche ich eine Abfrage, die mir nicht nur diese drei Werte ausgibt, sondern in einer vierten Spalte zusätzlich den Wert, wie oft der Wert tour=x vorhanden ist.

Also:
1 1 Anschrift 1 3 (weil Tour 1 3x vorkommt)
2 2 Anschrift 2 2 (weil Tour 2 2x vorkommt)
3 3 Anschrift 3 1 (weil Tour 3 1x vorkommt)
4 1 Anschrift 4 3
5 1 Anschrift 5 3
6 2 Anschrift 6 2

Kann mir da bitte jemand auf die Sprünge helfen - ich komm nicht drauf?

Danke und liebe Grüße
Oliver

Options: ReplyQuote


Subject
Views
Written By
Posted
Komplexe Abfrage
682
July 18, 2018 11:48PM
363
July 19, 2018 03:00AM
356
July 19, 2018 05:52AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.