excel vba - SQL - Get the most recent data -
hi guys hope can me!
i have done piece of code here:
" select distinct left(ut.text,27) " & _ " [mydatabase].[dbo].[table1] ut, dbo.table2 u " & _ " ut.table1 in (select unitid dbo.table2 serialno '" & cstr(right(sheet1.cells(i, 3), 8)) & "' ) " & _ " , ut.text 'epp:%' " & _ " , u.table2 = ut.table1 " & _ " order 1 "
it works perfectly! does? have sheet this:
order pid serial 3033421 6625mc3209 13-49026969 3033421 6625mc3209 13-49027001
it gets information on third column , uses search , paste data database fourth column.
my problem is: query pastes first information gets , need last information (or more precise latest information added). illustrate:
order pid serial epp 3033421 6625mc3209 13-49026969 123456789 2015-01-25 3033421 6625mc3209 13-49026969 987654321 2015-03-25
my query pasting data dates 2015-01-25 , need paste data dates 2015-03-25 (that recent one).
hope clear :p in advance!
Comments
Post a Comment