SQLize Online / PHPize Online  /  SQLtest Online

A A A
Share      Blog   Popular
Copy Format Clear
with t as ( select row_number() over(order by total_amount) as n, count(1) over() as cnt, total_amount from bookings where book_date between '2017-07-01' and '2017-07-31 23:59:59' ) select t.total_amount, t2.total_amount from t ,(select total_amount from t where n = cnt / 2 + 1) as t2 where n = cnt / 2

Stuck with a problem? Got Error? Ask ChatGPT!

Copy Clear