Hello,
This is going to sound strange but I have a webpage that displays a form showing the last record added. This is because further records share a lot of the same data, so only a few fields have to be changed. I use the max(ID) to do this:
I also have a side bar that shows the last 5 records so these can be easily editable (a link fires the ID of the record to the form):
Obiviously this also shows the last (max) ID which already appears in the main form. How do I show the penultimate 5 records before the last one to be added? I have tried this but it doesn't appear to work:
Thanks!
Neil
This is going to sound strange but I have a webpage that displays a form showing the last record added. This is because further records share a lot of the same data, so only a few fields have to be changed. I use the max(ID) to do this:
Code:
<cfquery name="lastid" datasource="swwdrawings"> select * from tblDrawingsData where ID = (select max(ID) from tblDrawingsData where AddedBy = '#username#') </cfquery>
Code:
<cfquery name="lastfive" datasource="swwdrawings" maxrows="5"> select * from tblDrawingsData where AddedBy = '#username#' order by ID desc </cfquery>
Code:
<cfquery name="lastfive" datasource="swwdrawings" maxrows="5"> select * from tblDrawingsData where AddedBy = '#username#' and ID <> (select max(ID) from tblDrawingsData where AddedBy = '#username#') order by ID desc </cfquery>
Neil
Comment