sql - Pulling last 10 orders from mysql table -


i'm new mysql , i'm trying figure out if there way can pull information the last 5 recent orders.

i'm trying pull ordernumber, productname, , firstname last 5 recent orders.

i created 2 dummy tables i'm working with:

table: orders

fields: ordernumber customeroid orderinformationoid purchasedatetime

table: customerdata

fields: customeroid firstname middleinitial lastname

table: products

fields: productoid productname companyoid

i thinking inner join how determine recent orders?

i suppose there's productoid column in orders table, can use query:

select o.ordernumber, p.productname, c.firstname   (select ordernumber, customeroid, productoid    orders    order purchasedatetime desc    limit 5) o   inner join customers c on o.customeroid = c.customeroid   inner join products p on o.productoid = p.productoid 

Comments

Popular posts from this blog

php - Magento - Deleted Base url key -

javascript - Tooltipster plugin not firing jquery function when button or any click even occur -

java - WrongTypeOfReturnValue exception thrown when unit testing using mockito -