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: 

select statement

Former Member
0 Kudos

hi guyz,

im wondering if therez anyway to compare two values for the same field in the where condition of select statement. plz advise..

thanks

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi,

If you are talking about specifying two values for the same field in the WHERE condition in the SELECT statement, Yes it is possible.


update sflight
   set fldate = w_date
 where carrid in ('AA','LH')
   and connid in ('0010','0011').

If you want to compare two fields in the Select statement,


SELECT

WHERE (CARRID EQ 'AA' OR CARRID EQ 'LH').

10 REPLIES 10

Former Member
0 Kudos

Use-

select xyz

from xyz

into xyz

where ( field eq value1 or field eq value2 )

Regards,

Aparna Gaikwad

Former Member
0 Kudos

Hi,

You can use two times the same field in the where clause with different values for the field.

Thanks

Sudharshan

JozsefSzikszai
Active Contributor
0 Kudos

hi,

did you try?

SELECT ...

WHERE ( field EQ a OR field EQ b )

or is it not your question?

ec

Former Member
0 Kudos

Hi,

If you are talking about specifying two values for the same field in the WHERE condition in the SELECT statement, Yes it is possible.


update sflight
   set fldate = w_date
 where carrid in ('AA','LH')
   and connid in ('0010','0011').

If you want to compare two fields in the Select statement,


SELECT

WHERE (CARRID EQ 'AA' OR CARRID EQ 'LH').

Former Member
0 Kudos

hiii

yse you can use it like below query.

SELECT matnr                         " Material Number
    FROM mara
    INTO TABLE i_mara
   WHERE matnr = '000000000000002132'
      OR matnr = '000000000000002137'.

regards

twinkal

vinod_vemuru2
Active Contributor
0 Kudos

Hi,

Yes we can do it using IN operator.

SELECT...FROM ... INTO TABLE ....

WHERE field IN ( 'Value1' , 'value2' )

AND....

Thanks,

Vinod.

Former Member
0 Kudos

hi,

use self mapping using Alias.

1.make an inner join of a table with alias *a* once and *b* again.

2.Now compare a-field EQ b-field.

Regards,

anirban

Former Member
0 Kudos

Hi!

SELECT * FROM mara

INTO TABLE gt_mara

WHERE matnr ='A' OR matnr = 'B'.

Regards

Tamá

former_member223537
Active Contributor
0 Kudos

Hi,

Select * from mara
       into table gt_mara
       where MTART IN ( 'ZA' , 'ZB' ).

Best regards,

Prashant

Former Member
0 Kudos

HI,

Yes, you can compere two values for the same field in WHERE clause of SELECT statement.

SELECT <field1> <field2>... from <table> into table <Internal Table> where

<field1> = <val1> OR

<field1> = <var2> OR

<field1> = <val3>.

or

SELECT <field1> <field2> ... from <table> INTO TABLE <internal table> where

<field1> IN <val1, val2, val3 ...).

Hope this will be useful.

Cheers

Ramaraju