Hi,
I have 3 columns from a table (Comments) I need to report on.
1. Comment
2. CreatedDate
3. ProjectNo
I need to return the latest Comment, but when I try to write some SQL and use the GroupBy expression, I have to group by all fields (apart from the Created Date, as i'm using a MAX expression on that field)
can anyone suggest how I can acvhieve this.
currently the SQL is:
SELECT ProjectNo, Comment, MAX(CreatedDate)
FROM Comments
GROUP BY ProjectNo, Comment
as the comment field is a free form text field, this is going to return a row for each comment.
I only want the very latest one.
thanks in advance,
Matt
London (UK)
I have 3 columns from a table (Comments) I need to report on.
1. Comment
2. CreatedDate
3. ProjectNo
I need to return the latest Comment, but when I try to write some SQL and use the GroupBy expression, I have to group by all fields (apart from the Created Date, as i'm using a MAX expression on that field)
can anyone suggest how I can acvhieve this.
currently the SQL is:
SELECT ProjectNo, Comment, MAX(CreatedDate)
FROM Comments
GROUP BY ProjectNo, Comment
as the comment field is a free form text field, this is going to return a row for each comment.
I only want the very latest one.
thanks in advance,
Matt
London (UK)