Is this legal SQL?
select (153 div 31) as v1
And if so, is it legal to substitute sub-queries that return a single row
and column result as in this next query? (final question, will Drill
support this)
select (
(
(
SELECT COUNT(*) AS maxvalue
FROM bidemo.Sales s
inner join
bidemo.customer c on c.CustomerSId = s.CustomerSId
inner join
bidemo.orders o on o.OrderSId = s.OrderSId
WHERE c.CustomerId =1001
GROUP BY c.CustomerId order by maxvalue desc limit 1
)*100) div
(
SELECT COUNT(*) AS maxvalue
FROM
bidemo.Sales s
inner join
bidemo.customer c on c.CustomerSId = s.CustomerSId
inner join
bidemo.orders o on o.OrderSId = s.OrderSId
GROUP BY c.CustomerId order by maxvalue desc limit 1 )
) as v1