stephenz43
asked on
sql Next to last Record
Greeting
I cant figure out a query that retrieves only the next to last record where the account number = some value ( not the last record inserted into the dbase)
Im using vb 2005 and access
Any idea's ?
I cant figure out a query that retrieves only the next to last record where the account number = some value ( not the last record inserted into the dbase)
Im using vb 2005 and access
Any idea's ?
ASKER
hey guidway....
Getting close, but can [some value] be obtained using max[acct_id) ?
steve
Getting close, but can [some value] be obtained using max[acct_id) ?
steve
you could try a subquery
Select acct_id from [sometableName] where acct_id < (Select max(acct_id) from [sometableName]) order by acct_id DESC
Select acct_id from [sometableName] where acct_id < (Select max(acct_id) from [sometableName]) order by acct_id DESC
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
oops you said access... sorry. ;)
max function does work in access i believe
glad it worked for you. :)
ASKER
thank you for the help...You saved me alot of aggravation
take care
take care
Select acct_id from [sometableName] where acct_id < [some value] order by acct_id DESC;
then just grab the first record returned and that should be the second to last;