1

Topic: Aggregation with subqueries

Children, prompt, please, that I not so do... An eternal problem with subqueries - they do not work For me)))) Here I twist, I twirl - again does not work
select maker
from Product
inner join PC
on
Product.model = PC.model
where speed in (select max (a.speed) from (
select min (ram), maker, speed, Product.model
from Product
inner join PC on
Product.model = PC.model
group by maker, speed, Product.model
) as a)
No column name was specified for column 1 of ' a '.
select max (a.speed) from (
select min (ram), maker, speed, Product.model
from Product
inner join PC on
Product.model = PC.model
group by maker, speed, Product.model
) as a)
The same error though like syntax I do not break, neither in the first, nor in the second variant.
The maximum on speed among a minimum on other field is necessary

2

Re: Aggregation with subqueries

To you say what error at you, what in it not clear?

[b] No column name was specified for column 1 of ' a ' [/b]

3

Re: Aggregation with subqueries

123123;
He swears on max (a.speed), but this field is in a subquery.

4

Re: Aggregation with subqueries

Stop to publish problems and decisions with sql-ex;
Your subject here close, and most on that site

5

Re: Aggregation with subqueries

isq1992 wrote:

123123;
He swears on max (a.speed), but this field is in a subquery.

you are not able also to read?
What request at you under  and? What in it the first field?

6

Re: Aggregation with subqueries

Sergey Sizov;
With  it deduces request and on min does not swear.  begin, when I turn this request in another select

7

Re: Aggregation with subqueries

isq1992 wrote:

Sergey Sizov;
With  it deduces request and on min does not swear.  begin, when I turn this request in another select

That's it! And the reason for you is written. Really so it is difficult to guess to name a field?

8

Re: Aggregation with subqueries

isq1992;
And you its boot push:

select min (ram) AS MinivalValue, maker, speed, Product.model
from Product
inner join PC on
Product.model = PC.model
group by maker, speed, Product.model

9

Re: Aggregation with subqueries

Yasha123;
I do not publish the decision, as well as the job. The job there another also includes some more conditions of performance. At me really problem with subqueries, I already solved and solved this task, under another , and to that  I can return - but I will not be. Transited year - and I again on the same rake, the same problem. And I will solve all tasks on subqueries. At first under one , then under new - while in my head not to be postponed.

10

Re: Aggregation with subqueries

xenix;
Thanks huge!!!!!!!!!!!!!!!!!!!!!!!! Earned, but I, fairly, do not catch up - why the alias is necessary, after all in the second  (MAX) the link specified (a.) Probably on a forehead to itself it is necessary to cut simply, as a rule

11

Re: Aggregation with subqueries

isq1992;
Well because there is such general rule: it is better to return named set of fields

12

Re: Aggregation with subqueries

isq1992 wrote:

Yasha123;
I do not publish the decision, as well as the job.

I.e. here it not the job:

wrote:

the maximum on speed among a minimum on other field

Is necessary
Your code not the decision;
And I generally a March hare?