HawkeyeNash
asked on
Select MIN date from view
I have a view (vwHistory). This view is a history of events that have happened to a claim. It looks something like this:
vwHistory
ClaimNumber (varchar)
EventDate (DateTime)
Attribute1 (varchar)
Attribute2 (varchar)
Attribute3 (varchar)
ClaimNumber and EventDate together make a composite key.
I need a select statement that will give me all of the data values for the earliest EventDate for a particular claim number.
For example if my table looks like this:
ClaimNumber EventDate Att1 Att2 Att3
1 1/1/04 A B C
1 1/2/04 D E F
1 1/3/04 G H I
2 1/1/04 J K L
2 1/2/04 M N O
3 1/5/04 P Q R
Then my result set would look like this:
ClaimNumber EventDate Att1 Att2 Att3
1 1/1/04 A B C
2 1/1/04 J K L
3 1/5/04 P Q R
Attributes 1 - 3 may or may not be identical for each row.
Thanks in advance,
HawkeyeNash
vwHistory
ClaimNumber (varchar)
EventDate (DateTime)
Attribute1 (varchar)
Attribute2 (varchar)
Attribute3 (varchar)
ClaimNumber and EventDate together make a composite key.
I need a select statement that will give me all of the data values for the earliest EventDate for a particular claim number.
For example if my table looks like this:
ClaimNumber EventDate Att1 Att2 Att3
1 1/1/04 A B C
1 1/2/04 D E F
1 1/3/04 G H I
2 1/1/04 J K L
2 1/2/04 M N O
3 1/5/04 P Q R
Then my result set would look like this:
ClaimNumber EventDate Att1 Att2 Att3
1 1/1/04 A B C
2 1/1/04 J K L
3 1/5/04 P Q R
Attributes 1 - 3 may or may not be identical for each row.
Thanks in advance,
HawkeyeNash
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Had the join in the wrong place.
Much appreciated.