Get max date from array
Get max date from array
Hi,
I have two joined tables as follow:
Table 1: Customer
Table 2: Orders
I would like to get just the latest date of the order not all dates. Moreover, if a customer has three orders I want to get a customer details with the latest order's date.
Example:
customer 1 ---> 01/05/2021
customer 1 ---> 10/05/2021
customer 1 ---> 20/05/2021
Get just
customer 1 ---> 20/05/2021
Thanks
This discussion has been closed.
Replies
These are the questions that come to mind:
What language? JS? PHP? SQL? etc.
Are these database tables? What is the foreign key relationship between Customer and Order?
Ok I am guessing you mean SQL and you have database tables. Just google it. You'll find plenty of posts.
Here are two from SO:
https://stackoverflow.com/questions/18694094/select-only-rows-by-join-tables-max-value/18694271
https://stackoverflow.com/questions/27991484/using-max-within-inner-join-sql
Thanks for your answer.
The language is PHP with Mysql. I think it is clear to the majority in this community, the relationship between Customer and Orders.
I khow how to get the maximum date in pure PHP, but my question about datatables editor.
Use subselects in the respective Editor where clause.
solve it
thanks