Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
giszzmo
Starting Member
29 Posts |
Posted - 2015-01-26 : 17:36:35
|
Hello, I have a query that needs to display all grades within the current semester. Grades are usually updated every day, but occasionally they are not so I have to use the MAX function to return the latest grades and to determine what the current semester is. I am not sure how to query all grades in "Spring," which should match that of the MAX date. It can't be hard coded either. The data I'm working with looks like:Semester DateSpring 2015-01-15 Spring 2015-01-13 Spring 2015-01-09Fall 2014-12-21Fall 2014-21-11Fall 2014-01-07I was thinking it should be in the WHERE clause:WHERE Semester like (select MAX(convert(date,GradeDate))'Grade Date') Basically, whatever the semester is for the MAX date, that's the semester that I need all the grades from and all the dates that they were uploaded (not just MAX). If anyone could point me in the right direction. Thanks! |
|
waterduck
Aged Yak Warrior
982 Posts |
Posted - 2015-01-26 : 20:45:49
|
can you show how is yours expected result will looks like? |
|
|
gbritton
Master Smack Fu Yak Hacker
2780 Posts |
Posted - 2015-01-27 : 09:09:17
|
Sounds like a homework question. You need to work on it a bit more before posting here. |
|
|
giszzmo
Starting Member
29 Posts |
Posted - 2015-01-27 : 09:27:55
|
Lol! Sounds like not! |
|
|
viggneshwar
Yak Posting Veteran
86 Posts |
Posted - 2015-01-28 : 03:12:59
|
Use the max(semesterdate) in group by semestername. That will give you the max date of all the semesters. Using that result you can perform your logicsRegardsViggneshwar A |
|
|
|
|
|