Copy link to clipboard
Copied
Hi,
I hope somebody can help me with this. I use php/MySQL.
I need t create a repeated region which doen't include the last item (post) added to the table.
Does somebody know how to establish this?
Copy link to clipboard
Copied
In SQL, there is no native concept of the last item inserted. It's up to you to control that. What is your definition of the last item? Is it the row with the greatest datetime stamp? An autoincrement id field? Something else?
Using an autoincrement id field as an example, the last row inserted will have the largest value, so
Select * from MyTable where MyID != (select max MyID from MyTable)
Copy link to clipboard
Copied
Thanks Bregent,
I use an autoincrement id field so your example is very helpful.
Copy link to clipboard
Copied
Great. I just noticed a few typos in my SQL but you get the idea.
Find more inspiration, events, and resources on the new Adobe Community
Explore Now