I have two tables one of clients and one of sales where I must select the 30 LATEST records added to the sales table, show the information of the clients that made those transactions and order them upwards with respect to the id of sales . the fields of both tables are:
customers
id , nombre, apellido_paterno,apellido_materno, rut, dv
sales
id, cliente_id, fecha
I have the following query that returns the information of the clients that have been registered in the sales table, but I need only to select the last 30 sales made and order them by their id.
select nombre,apellido_paterno,apellido_materno,rut,dv,venta.id,venta.fecha
from cliente inner join venta on cliente.id = venta.cliente_id