Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Select First Record
Message
 
À
Tous
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Syntaxe SQL
Titre:
Select First Record
Divers
Thread ID:
00514286
Message ID:
00514286
Vues:
40
Dear All:

Suppose we have a table containing data:

TABLE1
code1 code2 year units amount
A C1 2000 1 10 <------ First Record
A C2 2000 2 20
A C3 2000 3 30
A C4 2001 4 40 <------ First Record
A C5 2001 5 50
A C6 2001 6 60
B C1 2000 1 10 <------ First Record
B C2 2000 2 20
B C3 2000 3 30
B C4 2001 4 40 <------ First Record
B C5 2001 5 50
B C6 2001 6 60
C C1 2000 1 10 <------ First Record
C C2 2000 2 20
C C3 2000 3 30
C C4 2001 4 40 <------ First Record
C C5 2001 5 50
C C6 2001 6 60


Is there a way we can create a Select statement whose result must look like this:

Select Result:
code1 code2 year units amount
A C1 2000 1 10
A C4 2001 4 40
B C1 2000 1 10
B C4 2001 4 40
C C1 2000 1 10
C C4 2001 4 40

(Wherein I 'first record' of the select group is selected(as indicated by the Arrows).

2. I had Problems regarding cursors. How can we handle 2 cursors is SQL Procedures.
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform