提问人:Ianspeed 提问时间:10/26/2023 更新时间:10/26/2023 访问量:14
MySQL,尝试对联接表进行排序以获取客户订单的最新行,以查看他们上次订购的时间
MySQL, trying to sort a joined table to get the latest row for a customers order, to see when they last ordered
问:
我正在运行用户/客户列表,并使用user_id作为连接加入订单文件,然后使用上次订购日期更新客户表。 正在发生的事情是它带回了最旧的/第一行,而不是最后一行/最新的行,我已经尝试了各种方式,但它似乎不喜欢我在对语句中的表格进行排序/排序方面所做的任何事情......
现在变得绝望了 如何从订单文件中获取最新行?
提前致谢...
UPDATE j423_customer_
JOIN j423_hikashop_order ON j423_customer_.user_id = j423_hikashop_order.order_user_id
SET j423_customer_.lastordereddate = j423_hikashop_order.order_created, j423_customer_.lastordereddatehuman = FROM_UNIXTIME(j423_hikashop_order.order_created)
WHERE j423_hikashop_order.order_status = "addedtocadpostagelabelfile"
OR j423_hikashop_order.order_status = "shipped"
OR j423_hikashop_order.order_status = "mailmergeadded"
AND (j423_hikashop_order.order_created >= '1445836026');
答: 暂无答案
评论