MySql中order by和union all同时使用

时间:2022-09-20 15:07:53
(SELECT * FROM `idents` where PhotoID = 'badc74d6-58bd-4e46-9a48-aefb3487a61d' AND Selected = 'Yes' ORDER BY IdentTime desc LIMIT 1)
UNION ALL
(SELECT * FROM `idents` where PhotoID = 'badc74d6-58bd-4e46-9a48-aefb3487a61d' AND Author = 'devtest'  ORDER BY IdentTime desc limit 1)

两边的语句加上括号就可以了