在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_dateSQLFiddle演示
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_dateSQLFiddle demo
更多推荐
发布评论