Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Alternative of this

Former Member
0 Kudos
78

Hi All,

Can you provide me with the alternative Query for finding the maximum

Maxnu = 0.

Select * from <DB Table> where Field = ‘Condition’ and Field = ‘Condition’.

Check DB Table-field > maxnu.

Maxnu = DB Table-field .

Endselect.

Thanks

Avi

1 ACCEPTED SOLUTION

Former Member
0 Kudos
55

Hullo,

there is a max function in the select clause:

SELECT MAX( <fieldname> ) FROM <db_table> 
                         WHERE <field1> = <condition1>
                           AND <field2> = <condition2>.

Hope this helps.

4 REPLIES 4

Former Member
0 Kudos
55

Hi

select field

from table

into itab

sort itab by field descending

read itab index 1.

this will contain the max value

another way of doing it would be

Select field into ws_field

from tablexy

up to 1 rows

where condition

order by field descending.

Former Member
0 Kudos
55

Hi,

Hope is this the alternative

Select max( fligh ) from zflight into maxnu where airln = ‘LF’ and cntry = ‘IN’.

Thanks

MAx

Former Member
0 Kudos
56

Hullo,

there is a max function in the select clause:

SELECT MAX( <fieldname> ) FROM <db_table> 
                         WHERE <field1> = <condition1>
                           AND <field2> = <condition2>.

Hope this helps.

Former Member
0 Kudos
55

Hello,

Welcome to the SDN,

Try like this,

SELECT MAX( fieldname ) FROM dbtable WHERE condition.....

This will help. Hit back if it doesnt.

Regards,

Shehryar Dahar