I do not know much about MySQL but if you have the aggregate function MAX() you can use it to retrieve the last inserted record in a table as
SELECT MAX(employeeID) FROM Table
or you can you use a subquery as
SELECT firstName, lastName, gender, salary ... FROM Table WHERE employeeID IN/= (SELECT MAX(employeeID) FROM Table)
this will return you the data of an employee which has the max employeeID value number for example if you have 5 employees numbered as 1, 2, 3, 4 and 5 you will get the data for the employee number 5. Hope this work for you
if you do not have the MAX() function in MySQL try to google for its MySQL equivalent. You can also use the COUNT() aggreagate function if you have it or google for its equivalent as it will return you a the number of records you have as on the above example if you have 5 reords it will return you a value 5 so the result will look like it is
SELECT firstName, lastName, gender, salary ... FROM Table WHERE employeeID = 5
The differenece between MAX() and COUNT() is that MAX() will return you the maximum value inside the table not the number of records meaning that if you have unordered employeeID number say 1, 12, 25, 40 and 60 so it will return you 60 as a result, however, the COUNT() function will return you 5 as the they are 5 numbers means 5 records. I hope you got the idea and I explain it well for you
Use the top 1 function and then order by ID desc for you to get the last ID.
i am trying to create a library management system which is supposed to be used to store/keep infp for the library and the library members( book title, author, name and picture for borrower and other stuffs). The app has 6 buttons, delete, save, add,previsous,next, and upload( for upload ...
Im trying to bind my custom vertical scrollbar to datagridview is this possible.. Please help Thnak you..
I have two tables, I will call them first-half and second-half (of the year)
Table: first id jan feb mar apr ----------------------- 2 80 90 70 60 3 50 40 60 30 Table: second id jan feb mar apr ----------------------- 2 50 70 60 90 3 80 60 50 ...