在mysql中查找四个表中最大的值(Find the greatest value among four tables in mysql)

编程入门 行业动态 更新时间:2024-10-27 23:19:58
在mysql中查找四个表中最大的值(Find the greatest value among four tables in mysql)

我有四个表中的产品,客户,商店,世界在MySQL中具有相同名称的日期列。 我想要做的是我想在所有四张表的DATE COLUMN中找到最大的日期 。 我不希望每桌的最佳约会,而是所有四桌中最大的约会。 我希望你能理解。 请帮帮我

I have a column Date with the same name in four tables Products, Customers, Shops, World in mysql. what i want to do is that i want to find the greatest date in the DATE COLUMN of all four tables. I don't want the greatest date of every table but the greatest one in all four tables. I hope you are understanding. Please help me

最满意答案

我能想到的最有效的方法是使用greatest功能:

select greatest( (select max(date) from products), (select max(date) from customers), (select max(date) from shops), (select max(date) from world) ) greatest_date

SQLFiddle演示

The most efficient way I can think of would be using the greatest function:

select greatest( (select max(date) from products), (select max(date) from customers), (select max(date) from shops), (select max(date) from world) ) greatest_date

SQLFiddle demo

更多推荐

本文发布于:2023-08-06 03:12:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1444623.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:Find   mysql   tables   greatest

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!