www.webdeveloper.com
Results 1 to 3 of 3

Thread: [RESOLVED] select statement to get the all data with last sr_number save

  1. #1
    Join Date
    Oct 2011
    Posts
    350

    resolved [RESOLVED] select statement to get the all data with last sr_number save

    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

    Code:
    SELECT last_insert_id(sr_number), sr_date, Items, SubItems, ItemCode, DemandedQty FROM stock_requisition;
    it display all data from my database.

    Code:
    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
    Attached Images Attached Images

  2. #2
    Join Date
    May 2004
    Location
    chennai, tamil nadu, India
    Posts
    448
    Code:
    SELECT sr_number, sr_date, Items, SubItems, ItemCode, DemandedQty FROM stock_requisition WHERE  sr_number = (SELECT max(sr_number) from stock_requisition)
    Chris, Senior Developer,
    Php laravel developers,
    www.chrisranjana.com

  3. #3
    Join Date
    Oct 2011
    Posts
    350
    Quote Originally Posted by chrisranjana View Post
    Code:
    SELECT sr_number, sr_date, Items, SubItems, ItemCode, DemandedQty FROM stock_requisition WHERE  sr_number = (SELECT max(sr_number) from stock_requisition)
    Thank you..

    It resolved my problem

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles