Thilagam
Thilagam

Reputation: 65

Get the recent value in MySQL

My table is as follows

Id InvoiceNo Status    Amt
1  ABC/1     Paid      100
2  ABC/2     Pending   200
3  XYZ       Rejected  100

The result I want is as follows

Id InvoiceNo  Status      Amt
1  ABC        Pending     300
2  XYZ        Rejected    100

Kindly help me to get the solution. Thanks in advance.

Upvotes: 0

Views: 25

Answers (1)

Gajjar Parth
Gajjar Parth

Reputation: 57

Try following query:

Select * from table_name where Status != 'Paid' GROUP BY InvoiceNo

Upvotes: 1

Related Questions