比如:我有一个产品表,然后产品表里面有用户的产品更新时间(lastChangedByUser)和管理员的产品更新时间(lastUpdatedByAdmin)等两个字段,然后获取产品数据的时候,想按照哪个时间最新就按照哪个时间排序。应该如何在mysql中处理?谢谢
现在的mysql语句如下:
SELECT p.productId,p.productTitle,s.supplierName AS sName
FROM products AS p,suppliers AS s
WHERE p.supplierId=s.supplierId AND s.language='en'
ORDER BY p.lastChangedByUser DESC,p.lastUpdatedByAdmin DESC
LIMIT 0,12