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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SELECT Query

Status
Not open for further replies.

krisboy

Technical User
Mar 4, 2002
16
0
0
AU
Help!

I have a table which contains updates to support calls. I need a select query which will select the latest update to a support call - this will entail selecting only those records where the problem_id for each call is the highest. For example:

Call_number Problem_id
1-1-1 1
1-1-1 2
1-1-1 3
1-1-1 4
1-1-2 1
1-1-2 2
1-1-2 3

The query should return only the following rows from the above table:

Call_number Problem_id
1-1-1 4
1-1-2 3

And thus the latest update to the call.

It's probably quite simple, but can anyone help me with this?

Chris.
 
SELECT call_number, Max(problemid) AS lastproblem
FROM yourtablename
GROUP BY call_number
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top