Thanks for all the help guys! I finally have the correct SQL statement:
mysql> select distinct order_id, max(memo_id), memo_time, status_id, memo_read
-> FROM order_memo
-> GROUP BY order_ID
-> ORDER BY order_id ASC , memo_id DESC
-> LIMIT 10 ...
Yeah i need the max memo_id from every order_id, that's becasuse i need to make a mailing every night to the admins, office and manufactors (where the order_id is assigned to) so they know the last status (at the last memo_id).
Hi Bastien,
Here is my SQL Result.
mysql> select distinct(order_id),memo_id ,memo_time, status_id, memo_read
-> FROM order_memo
-> ORDER BY order_id ASC , memo_id DESC
-> LIMIT 10;
+----------+---------+---------------------+-----------+-----------+
| order_id | memo_id |...
SELECT DISTINCT (
order_id
), *
FROM `order_memo`
ORDER BY order_id ASC , memo_id DESC
LIMIT 10
MySQL retourneerde:
You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '*
FROM `order_memo`
ORDER BY...
Hi Everyone.
I have the following situation:
TABLE: order_memo
mysql> SELECT * FROM
`order_memo` ORDER BY `order_id` LIMIT 10;
+----------+---------+---------------------+-----------+-----------+
| order_id | memo_id | memo_time | status_id | memo_read |...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.