Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Earliest Open Date Data

Status
Not open for further replies.

Schaeffrcc

Technical User
May 29, 2003
19
US
I have a table that is used to keep history of client movement and most clients have 3 or 4 records in the table.

I.E:

Table 1
Seq 1 2 3 4
Name Tom Bill Tom Jan
Open Date 1/2/2000 1/5/2002 2/5/2002 5/2/2003
Close date 2/1/2001 Null Null 6/2/2003
Case Type 2 5 5 3

I am looking to get data that is opened on or after 1/1/2000(>=)and have a case type of 2 or 5.

The Query Returns Seq 1,2,3 and I want to get only records 1 and 2.

I only want to get each Name once but get Tom Twice because he has two recods that meet the criteria. Is there a way to get distinct name records with the earliest Open Date or Seq. number.


I hope this makes Sense.

Thanks,

Thomas.
 
select min(seq) as seq from table1 where name in (select name from table1 where opendate >='1/1/2002' and type in (2,5)) group by name order by seq
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top