MAX without FROM

Started by Angshu Karabout 20 years ago5 messagesgeneral
Jump to latest
#1Angshu Kar
angshu96@gmail.com

Hi,

Can I use Select max(a field returned from another query)?
say, another query returns say 10,1,2,3,6,7

Thanks,
AK
--
Ignore the impossible but honor it ...
The only enviable second position is success, since failure always comes
first...

#2Scott Marlowe
smarlowe@g2switchworks.com
In reply to: Angshu Kar (#1)
Re: MAX without FROM

On Thu, 2006-01-12 at 12:58, Angshu Kar wrote:

Hi,

Can I use Select max(a field returned from another query)?
say, another query returns say 10,1,2,3,6,7

Does this form help you:

select max(a) from (select 1 as a union select 2 union select 3) as b;

#3Angshu Kar
angshu96@gmail.com
In reply to: Scott Marlowe (#2)
Re: MAX without FROM

What are 1 ,2 and 3 in your query?

Here is my inner query which returns a set of min values. I want to get the
max out of the returned mean values...

select min(evalue) as M from distance where query_id
in (select entry_id from partition where partition = 849)

On 1/12/06, Scott Marlowe <smarlowe@g2switchworks.com> wrote:

On Thu, 2006-01-12 at 12:58, Angshu Kar wrote:

Hi,

Can I use Select max(a field returned from another query)?
say, another query returns say 10,1,2,3,6,7

Does this form help you:

select max(a) from (select 1 as a union select 2 union select 3) as b;

--
Ignore the impossible but honor it ...
The only enviable second position is success, since failure always comes
first...

#4Scott Marlowe
smarlowe@g2switchworks.com
In reply to: Angshu Kar (#3)
Re: MAX without FROM

On Thu, 2006-01-12 at 13:14, Angshu Kar wrote:

What are 1 ,2 and 3 in your query?

Here is my inner query which returns a set of min values. I want to
get the max out of the returned mean values...

select min(evalue) as M from distance where query_id
in (select entry_id from partition where partition = 849)

On 1/12/06, Scott Marlowe <smarlowe@g2switchworks.com> wrote:
On Thu, 2006-01-12 at 12:58, Angshu Kar wrote:

Hi,

Can I use Select max(a field returned from another query)?
say, another query returns say 10,1,2,3,6,7

Does this form help you:

select max(a) from (select 1 as a union select 2 union select
3) as b;

The select 1 as a union ... part was just showing where you could put a
REAL query that had multiple rows.

Where is your evalue coming from, is that from partition? If so, you
might be better off with a join of some kind. Maybe if you explain a
little more what your data sets are and what you're trying to get from
them...

#5Angshu Kar
angshu96@gmail.com
In reply to: Scott Marlowe (#4)
Re: MAX without FROM

Thanks Scott. I've used another way of getting the max - I've used order by
desc in my inner query and selected top 1 to get the max value ...

On 1/12/06, Scott Marlowe <smarlowe@g2switchworks.com> wrote:

On Thu, 2006-01-12 at 13:14, Angshu Kar wrote:

What are 1 ,2 and 3 in your query?

Here is my inner query which returns a set of min values. I want to
get the max out of the returned mean values...

select min(evalue) as M from distance where query_id
in (select entry_id from partition where partition = 849)

On 1/12/06, Scott Marlowe <smarlowe@g2switchworks.com> wrote:
On Thu, 2006-01-12 at 12:58, Angshu Kar wrote:

Hi,

Can I use Select max(a field returned from another query)?
say, another query returns say 10,1,2,3,6,7

Does this form help you:

select max(a) from (select 1 as a union select 2 union select
3) as b;

The select 1 as a union ... part was just showing where you could put a
REAL query that had multiple rows.

Where is your evalue coming from, is that from partition? If so, you
might be better off with a join of some kind. Maybe if you explain a
little more what your data sets are and what you're trying to get from
them...

--
Ignore the impossible but honor it ...
The only enviable second position is success, since failure always comes
first...