Can't find difficult SELECT query

  • Thread starter Thread starter Tommy DN
  • Start date Start date
T

Tommy DN

I can't find a select-query, but first I'm going to explain the
situation:

This can be a example of my table ( in real, it's more sophisticated
):
" Value " and " Time " are the fieldnames.

Value Time
* 1 1 *
2 1
3 1
* 2 2 *
3 2
* 3 3 *
* 4 4 *

So, I only need to select the Value with the highest Time ( Time and
Value are both integer (number) - fields ). The result must be what
I've set between '*':
Result:

Value Time
* 1 1 *
* 2 2 *
* 3 3 *
* 4 4 *

Does someone know I SQL-command for it?
 
I can't find a select-query, but first I'm going to explain the
situation:

This can be a example of my table ( in real, it's more sophisticated
):
" Value " and " Time " are the fieldnames.

Value Time
* 1 1 *
2 1
3 1
* 2 2 *
3 2
* 3 3 *
* 4 4 *

So, I only need to select the Value with the highest Time ( Time and
Value are both integer (number) - fields ). The result must be what
I've set between '*':
Result:

Value Time
* 1 1 *
* 2 2 *
* 3 3 *
* 4 4 *

Does someone know I SQL-command for it?

This will do the trick:

SELECT Table1.Value, Max(Table1.Time) AS MaxOffTime
FROM Table1
GROUP BY Table1.Value
ORDER BY Table1.Value;

Joop
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top