按组ID查看mysql顺序的最新存储值

your query execute only this is not correct see another example below

pid  customer id  invoice id     name  due amount make payment

 1      1001           086    sasi      36       sasi      10 
 5     1003            084    ram       100      ram       50
 7     1002            083    koushil   80       am         50

query is

SELECT * FROM print_reciept pr INNER JOIN ( SELECT invoice_id, MIN(pid) AS min_pid FROM print_reciept WHERE due_amount != 0 GROUP BY invoice_id ) t ON pr.invoice_id = t.invoice_id AND pr.pid = t.min_pid WHERE due_amount != 0;

see this again example

pid  customer id  invoice id  name  due amount make_pay paid_amount

1      1001           086    sasi      36       sasi      10   
2      1001           086    sasi      26       ram        5
3      1001           086    sasi      21       ravi      10 
4      1001           086    sasi      11       sasi      10     
5     1003            084    ram       100      ram       50
6     1003            084    raghu     50       sasi      10 
7     1002            083    koushil   80       am         50
8      1002           083     koushil  30        am        20 

this is my result but i am already pay due 6 amount in same id use invoice id 086

i need result

pid  customer id  invoice id     name  due amount make payment

 4      1001           086       sasi         11       sasi      10
 6     1003            084      raghu         50       sasi      10 
 8      1002           083     koushil        30        am       20 

I'm not sure I understood you correctly.

If you want to get the last value of invoice_id = 086:

SELECT pid, cust_id, cust_name, date, invoice_id, invoice_date, 
  invoice_amount, paid_amount, paymentmade, makeapayment, due_amount, status
FROM print_reciept
WHERE invoice_id = 086
  AND due_amount != 0
ORDER BY pid DESC
LIMIT 1;

If you want to get the last value for each invoice_id:

SELECT *
FROM print_reciept pr
    INNER JOIN
    (
        SELECT invoice_id, MIN(pid) AS min_pid
        FROM print_reciept
        WHERE due_amount != 0
        GROUP BY invoice_id
    ) t ON pr.invoice_id = t.invoice_id AND pr.pid = t.min_pid
WHERE due_amount != 0;
SELECT *
FROM print_reciept pr
    INNER JOIN
    (
        SELECT invoice_id, MAX(pid) AS min_pid
        FROM print_reciept
        WHERE due_amount != 0
        GROUP BY invoice_id
    ) t ON pr.invoice_id = t.invoice_id AND pr.pid = t.min_pid
WHERE due_amount != 0;