There are two tables ( orders , chat ) where order_id = chat_id . How can you select only the last entry in the pivot table (sort by date_time field) from the chat table when you select the Select table, given that the chat table can contain multiple values with the same chat_id ?
I fulfill request of a type:
SELECT o.Name, c.chat_id FROM Orders o LEFT JOIN chat c ON o.order_id=c.chat_id but displays a variety of values.
limit 1 does not fit because it completely limits the SELECT query and I need to select all values from the orders table and only the last values from the chat table. THOSE. for each o.order_id value, get the last value sorted by date from the chat table
order by date_time desc limit 1. - Mike