how to find last and second last record in separate column all customers | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

how to find last and second last record in separate column all customers

how to find last and second last recharge in separate column for all customers in sql Original table Customer _name|Recharge _mrp|Date Output seems like Customer name|last recharge|2nd_last recharge|date I have single table in which have column like customer name, recharge mrp , date how to find last and second last recharge in separate column for all customers in sql I have recharge mrp column i want customer wise last and second last recharge in separate column Please help me.

12th Aug 2019, 3:12 AM
Akshay
Akshay - avatar
1 Answer
+ 3
Which SQL engine do you use (MS SQL, MySQL, PostGresql, Oracle...)? What are the data types of your table? Did I understand right that you want the customer name and two dates in the result? Your explanation is not very clear.
13th Aug 2019, 7:43 PM
Tibor Santa
Tibor Santa - avatar