Hallo Forum,
ich habe eine Tabelle mit Auftragspositionen. Nun möchte ich als Ergebnis einer
Abfrage einen Zähler je Gruppe (Kundennummer). Ich habe dieses (und andere) Forum bereits gequält, habe auch eine Lösung für das komplette Durchnummerieren, jedoch nicht für meine geforderte Abfrage.
Gegeben ist folgende Tabelle:
ID DIS KGR KAL
------ ---- ----- -----
1136 K13 P2 5
1136 K13 R1 6
1136 K17 P/DA 5
1136 K24 P2 5
1136 K24 R1 6
1141 K13 P4 24
1141 K36 P4 24
1142 K27 R3 7
1142 LF3 G1 15
1142 LF3 G2 15
1147 K13 P2 5
1147 K36 P2 5
1149 K24 P2 5
1149 K27 P2 5
1149 K36 P2 5
Das Ergebnis soll sein:
LFD ID DIS KGR KAL
----- ------ ---- ----- -----
1 1136 K13 P2 5
2 1136 K13 R1 6
3 1136 K17 P/DA 5
4 1136 K24 P2 5
5 1136 K24 R1 6
1 1141 K13 P4 24
2 1141 K36 P4 24
1 1142 K27 R3 7
2 1142 LF3 G1 15
3 1142 LF3 G2 15
1 1147 K13 P2 5
2 1147 K36 P2 5
1 1149 K24 P2 5
2 1149 K27 P2 5
3 1149 K36 P2 5
Grupiert werden soll nach 'ID' und nach jedem
Gruppenwechsel soll wieder bei 1 angefangen werden
zu zählen.
Hat irgend jemand eine Idee?
Ach ja: SQL-Server 2000
Danke
ich habe eine Tabelle mit Auftragspositionen. Nun möchte ich als Ergebnis einer
Abfrage einen Zähler je Gruppe (Kundennummer). Ich habe dieses (und andere) Forum bereits gequält, habe auch eine Lösung für das komplette Durchnummerieren, jedoch nicht für meine geforderte Abfrage.
Gegeben ist folgende Tabelle:
ID DIS KGR KAL
------ ---- ----- -----
1136 K13 P2 5
1136 K13 R1 6
1136 K17 P/DA 5
1136 K24 P2 5
1136 K24 R1 6
1141 K13 P4 24
1141 K36 P4 24
1142 K27 R3 7
1142 LF3 G1 15
1142 LF3 G2 15
1147 K13 P2 5
1147 K36 P2 5
1149 K24 P2 5
1149 K27 P2 5
1149 K36 P2 5
Das Ergebnis soll sein:
LFD ID DIS KGR KAL
----- ------ ---- ----- -----
1 1136 K13 P2 5
2 1136 K13 R1 6
3 1136 K17 P/DA 5
4 1136 K24 P2 5
5 1136 K24 R1 6
1 1141 K13 P4 24
2 1141 K36 P4 24
1 1142 K27 R3 7
2 1142 LF3 G1 15
3 1142 LF3 G2 15
1 1147 K13 P2 5
2 1147 K36 P2 5
1 1149 K24 P2 5
2 1149 K27 P2 5
3 1149 K36 P2 5
Grupiert werden soll nach 'ID' und nach jedem
Gruppenwechsel soll wieder bei 1 angefangen werden
zu zählen.
Hat irgend jemand eine Idee?
Ach ja: SQL-Server 2000
Danke
Comment