我有个问题
SELECT name, salary/ (SELECT max(money) from table_sal) FROM table_a;
我听到一个错误说
Unsupported SubQuery Expression Invalid subquery. Subquery in SELECT could only be top-level expression
有办法解决这个问题吗?
rqqzpn5f1#
这个能用吗 CROSS JOIN ?
CROSS JOIN
SELECT name, salary / s.max_money FROM table_a CROSS JOIN (SELECT max(money) as max_money from table_sal) s
j13ufse22#
你也可以这样做如下,请让我知道它是否适合你。
Select t1.name , t1.salary/T2.max_money from (SELECT name , salary, 1 as dummy from table_a ) t1 Join (SELECT max(money) as max_money , 1 as dummy from table_sal) t2 on t1.dummy = t2.dummy ;
2条答案
按热度按时间rqqzpn5f1#
这个能用吗
CROSS JOIN
?j13ufse22#
你也可以这样做如下,请让我知道它是否适合你。