I wrote a PostgreSQL query as below, i would like to get data from both query and subquery but I don't know how to do that, can someone give me an excellent query, thank you in advance!
select
max(high),
min(low)
from
(
select
code,
close,
high,
low,
time
from
stock_prices as sp
where
stock_id = '1'
and time between (
select
(cast('2022-06-25' as DATE ) - interval '7 DAYS') as start time) and (
select
(cast('2022-06-25' as DATE )) as endtime)
order by
time desc
) as subtable;
