Hi…
I just want to know what is the code to get the last inserted row on database.
I tried max and last_insert_id yet it did not solve my problem
SELECT last_insert_id(sr_number), sr_date, Items, SubItems, ItemCode, DemandedQty FROM stock_requisition;
it display all data from my database.
SELECT max(sr_number), sr_date, Items, SubItems, ItemCode, DemandedQty FROM stock_requisition;
it only display last row… but I need to display all data with all data with same sr_number
for example :
1204100002
I attach my sample data from my database:
Thank you so much
Why don’t you add a specific value on sr_number such as:
SELECT sr_number=1204100002, sr_date, Items, SubItems, ItemCode, DemandedQty FROM stock_requisition;
Why don’t you explain a bit better what you need. Give an example of the result you want based on the table data you posted.
It resolved my problem:
SELECT sr_number, sr_date, Items, SubItems, ItemCode, DemandedQty FROM stock_requisition WHERE sr_number = (SELECT max(sr_number) from stock_requisition)
Thank you
r937
5
guido, why not wait a while before answering newphpcoder’s questions
he always posts them on about a half dozen other forums, and often, as in this case, gets an answer from somewhere else