MySql中order by和union all同时使用

(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)

两边的语句加上括号就能够了ide

相关文章
相关标签/搜索