我已经查看了许多解决这个问题的假设,但我仍然无法让它发挥作用。
SELECT Year FROM (SELECT DISTINCT YEAR(detDate1) AS Year
FROM growl_details WHERE publish = 'y' AND pubNews = 'y'
UNION
SELECT DISTINCT YEAR(detDate1) AS Year FROM growl_pl_details
WHERE publish = 'y' AND pubNews = 'y') AS t ORDER BY 'Year' ASC
我有两个表,growl_details 和 growl_pl_details,我试图让它们只显示存在信息的年份,然后这将用于创建一个表,其中包含指向与该年份相关的数据页面的链接。
显然,我希望按顺序显示年份,但上面的代码似乎是单独订购它们,并且它们相互依存..
有任何想法吗?