Meine Tabelle Input:Dynamische Abfrage SQL Server
cd SEQ status
DGH 1 Outstanding Requirement
OTH 1 Outstanding Requirement
OTH 2 O
OTH 3 O
OTH 1 Outstanding Requirement
OTH 2 O
OTH 3 O
OTH 4 O
OTH 5 O
Ich brauche Ausgang wie unten
cd SEQ MyOrder
DGH 1 DGH-1
OTH 1 OTH-1
OTH 2 OTH-1
OTH 3 OTH-1
OTH 1 OTH-2
OTH 2 OTH-2
OTH 3 OTH-2
OTH 4 OTH-2
OTH 5 OTH-2
Sie benötigen eine andere Spalte, um eine 'order by' zu erstellen - ohne sie können Sie die Reihenfolge der Ergebnisse nicht garantieren. – sgeddes