fraurig2018-02-05 17:59:34
fraurig, 2018-02-05 17:59:34

Another problem with the subquery. What to do with aggregate functions?

Colleagues, tell me, is it possible to use aggregate functions in an attachment?
Query doesn't work(
Expected result: output order with earliest start time

select  order_id  from  t2
where t2.START_TIME=(
select min(t2.start_time) 
from t2)

Answer the question

In order to leave comments, you need to log in

2 answer(s)
ISE73, 2018-02-05

Try this:
select order_gid from t2
where t2.START_TIME=(
select min(t3.start_time)
from t2 t3)

res2001, 2018-02-05

Aggregate functions must be used in conjunction with a group by clause. They can be used in a subquery.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question