-1
I have two tables and I intend to get you the name
table A
depending on the Num3
. For example, in the table A
, we have the num2
and in the table B
the values corresponding to the Num1
.
What I want is that the name
repeated the number of times corresponding to the maximum number of num3
related to the num2
.
For example, the num2 = 3
has as num3
maximum value 4
, or is it that he appears 4 times
Using these tables:
-- A (name,Num2, local)
insert into A values ('Favela',1,'WE');
insert into A values ('Lamosa',2,'NA');
insert into A values ('Luz',3,'S0');
-- B (Num1,name,Num2, Num3)
insert into B values (1,'Maria',1,1);
insert into B values (2,'Jorge',2,1);
insert into B values (3,'Teresa',2,1);
insert into B values (4,'Rui',3,1);
insert into B values (1,'Fran',3,3);
insert into B values (2,'Juliett',3,3);
It is possible to do this with sub-interrogation outside of From ?
– Força Chape
@Forcing What is a sub-interrogation?
– Sorack
what’s in the From do outside the From
– Força Chape
@Forcing did not understand his intention. What is inside the
FROM
determines the maximum number of interactions.– Sorack
Yes but for what I have to do there can be no questions ( that’s what’s in the from ) in the From field , only in the Where
– Força Chape
@Forcing this way there is no way, after all you have to figure out the maximum number somehow. Your question seems to be incomplete, if it should not be used
subquery
you should inform this in the question– Sorack
should be used subquery , but not in the from field , only in Where and also do not know how
– Força Chape
@Forcchape then put that in the question. Your question is not clear.
– Sorack
yes yes , I also just realized now
– Força Chape
@Force see the second solution at the bottom of the response.
– Sorack