Select into with max()
I have a basic query I use to determine the max value of a column in a table:
select A.revenue_code_id, max(A.revenue_code_version) from rev_code_lookup A
group by A.revenue_code_id
This results in ~580 rows (the entire table has over 2400 rows).
This works just fine for my query results but what I don't know is how to
insert the 580 rows into a new able based on the max value. I realize this
isn't the right code but what I am thinking of would look something like
this:
select * into new_table from rev_code_lookup where max(revenue_code_version)
No comments:
Post a Comment