Hello!
I'd like to be able to extract the most recent entries from the table and the construct in subject works with Sybase. For example:
Code:
select * from _DBF having M_IDENTITY=MAX(M_IDENTITY)
When trying to port the same query to the SQL-server, however, I get an error:
Code:
1> select * from dbo.t_mx_bond_quotes having ID=MAX(ID)
2> go
Msg 8121, Level 16, State 1, Server ADSRV215, Line 1
Column 'dbo.t_mx_bond_quotes.ID' is invalid in the HAVING clause because it is not contained in either an aggregate function or the GROUP BY clause.
This suggests, my query is somehow not quite fully standard -- how do I change it to be proper SQL?
Thanks!