我正在开发两个用户之间的消息系统,我想按发送时间对它们进行分组,只显示一次。 目前,我显示消息和每条消息的发送时间,但我只想显示会话中对它们进行分组的最后一条消息(就像Twitter的直接消息一样)。 SELECT id, author, datetime, text FROM messages WHERE author = 'A' AND receiver = 'B' 我拥有的(id /作者/日期时间/文本): 1 / A / 22/03/2019 22:15 / This is message 1
-----------------------------
我有两个问题。
第一个错误消息是它无法转换日期或时间。
select a.ProductID, sum(a.Quantity) as Qty ,SUM (a.SubTotal) as Sub
from TransactionDetail a join Transactions b on a.TransactionID = b.TransactionDate
group by productID
因此,我试图按以下方式转换日期和时间
select a.ProductID, sum(a.Quantity) as Qty ,SUM (a.SubTotal) as Sub
from Transact