sql - return only the rows with highest id -



sql - return only the rows with highest id -

this have:

select * table address1 in ('1235 mary st', '516 fred way', '89 valley st', '5416 apple ave') order name

the result set returns 100's of records these 4 addresses (this table purchase table) , table has id# each row want pull row highest id#. hope plenty info.

i think utilize max(table id#) in clause pulling highest table id 4 of these addresses. want recent

on databases back upwards windowing functions, can utilize row_number() assign increasing numbers per address:

select * ( select row_number() on (partition address1 order id desc) rn , * table address1 in (...) ) subqueryalias rn = 1 -- latest row per address

sql

Comments

Popular posts from this blog

model view controller - MVC Rails Planning -

ruby on rails - Devise Logout Error in RoR -

html - Submenu setup with jquery and effect 'fold' -