Thanks for the reply. I tried your query and it fails for the following example of data:
Table1:
ctid val dt
7 5 1/1/2006
7 8 4/1/2006
7 16 1/1/2007
9 4 2/24/2006
9 12 6/6/2006
9 6 12/12/2006
9 20 5/3/2007
10 3 12/12/2007
10 13 1/1/2007
I want to return:
ctid val dt
7 16 1/1/2007
9 20 5/3/2007
10 3 12/12/2007...
User Profile
Collapse
-
Need help with a query
Hi all,
I'm trying to
Select Top 1 value1 from table1
where CompID = 10
Order by mydate Desc
What this does is gives me the value of value1 for the max date.
Which works very well.
What I want to achieve is that get the max records for different compids = 7 or 9 or 10 etc. in the table.
Any ideas?
Thanks.
No activity results to display
Show More
Leave a comment: