Jump to content
  • 0

Finding Maximum Date


jsgarlata

Question

Hello, I have a database that is keeping attendance logs for students.  The attendance table basically consist of student name, student ID, and date attended.  I would like to pull up a list of all students and their last day that they attended (this would be the maximum date attended).  I wish to only see the student's last day, not all the records for that student.   so ultimately, my report would look like:

John Jones     1/1/17

John Smith    3/12/17

Joe Smith     2/28/17

I cant seem to find anywhere to do this.  

 

Thank you in advance

 

Link to comment
Share on other sites

3 answers to this question

Recommended Posts

  • 0
On 8/9/2017 at 4:02 PM, jsgarlata said:

Hello, I have a database that is keeping attendance logs for students.  The attendance table basically consist of student name, student ID, and date attended.  I would like to pull up a list of all students and their last day that they attended (this would be the maximum date attended).  I wish to only see the student's last day, not all the records for that student.   so ultimately, my report would look like:

John Jones     1/1/17

John Smith    3/12/17

Joe Smith     2/28/17

I cant seem to find anywhere to do this.  

 

Thank you in advance

 

Hey, I would recommend creating a report datapage using table with students (where each record is unique). Then insert calculated field on results page and run SQL query like that:

select Top(1) CONVERT(VARCHAR(32), Datefield, 1) from table_name where studentID = target.[@field:studentID] Order by Datefield Desc

Link to comment
Share on other sites

  • 0

You may also want to try this one: 

CONVERT(VARCHAR(10),(SELECT MAX(Test_Date_Of_Email) FROM Table2 WHERE Test_ID =target.[@field:Test_ID]),101)

CONVERT(VARCHAR(10),(SELECT MAX(TableFieldName) FROM Name_of_Table WHERE Field_Name =target.[@field:Field_Name]),101)

I hope this helps!

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...