how to get MaxEndDate?
SELECT distinct top 5 week, max(endday) as MaxEndDate FROM Reporting.fiscalcal WHERE (year = '2007' and week >= '20') group by week week MaxEndDate 20 05/18/07 21 05/25/07 22 06/01/07 23 06/08/07 24 06/15/07 How can i just get one MaxEndDate (06/15/07)??? Pls. help me out. Thank you. SSRSRpt
November 12th, 2010 8:52am

Hello, Just remove the GROUP BY from your select statement: SELECT max(endday) as MaxEndDate FROM Reporting.fiscalcal WHERE (year = '2007' and week >= '20') Olaf Helper ----------- * cogito ergo sum * errare humanum est * quote erat demonstrandum * Wenn ich denke, ist das ein Fehler und das beweise ich tglich http://olafhelper.over-blog.de
Free Windows Admin Tool Kit Click here and download it now
November 13th, 2010 2:06pm

If you want Max data out of top 5 weeks following needs to be done SELECT (T.MaxEndate) AS MaxEndDate FROM (SELECT distinct top 5 week, max(endday) as MaxEndDate FROM Reporting.fiscalcal WHERE (year = '2007' and week >= '20') group by week ) AS T Gaurav Gupta http://sqlservermsbiblog.blogspot.com/
November 13th, 2010 6:14pm

If you want Max data out of top 5 weeks following needs to be done SELECT (T.MaxEndate) AS MaxEndDate FROM (SELECT distinct top 5 week, max(endday) as MaxEndDate FROM Reporting.fiscalcal WHERE (year = '2007' and week >= '20') group by week ) AS T Gaurav Gupta http://sqlservermsbiblog.blogspot.com/ getting error msg Msg 207, Level 16, State 1, Line 1 Invalid column name 'MaxEndate'. SSRSRpt
Free Windows Admin Tool Kit Click here and download it now
November 15th, 2010 10:16am

Just a missing letter in SELECT (T.MaxEndate) ... => change it to SELECT (T.MaxEndDate) ...Olaf Helper ----------- * cogito ergo sum * errare humanum est * quote erat demonstrandum * Wenn ich denke, ist das ein Fehler und das beweise ich tglich http://olafhelper.over-blog.de
November 15th, 2010 11:04am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics