Showing only the first date for a selection of entries

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi all,

I am a little stuck. I basically want to see the first date when any person
has more than 60minutes free. import_date = the date the data was extracted.
So any information previous to the import date is not needed.

Select Zone, Person, min(Date), Time_Available
From Table_Export
Where (Date>import_date)
Group By Zone, Person, Time_Available
Having Time_Available>59

But what this shows is Every date where a person has more than 60 minutes
free.


Any help is much appreciated.

Ernest

sorry if double post
 
Ernest said:
I am a little stuck. I basically want to see the first date when any person
has more than 60minutes free. import_date = the date the data was extracted.
So any information previous to the import date is not needed.

Select Zone, Person, min(Date), Time_Available
From Table_Export
Where (Date>import_date)
Group By Zone, Person, Time_Available
Having Time_Available>59

But what this shows is Every date where a person has more than 60 minutes
free.

You need to take the Time_Available out of the SELECT and GROUP BY
clauses.

If you need to see Time_Available, you can write a second query that
joins your first query with Table_Export.
 

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