Application Development and Automation 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: 
Read only

select statement

Former Member
0 Likes
1,108

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
Read only

Former Member
0 Likes
1,082

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
Read only

Former Member
0 Likes
1,082

Use-

select xyz

from xyz

into xyz

where ( field eq value1 or field eq value2 )

Regards,

Aparna Gaikwad

Read only

Former Member
0 Likes
1,082

Hi,

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

Thanks

Sudharshan

Read only

JozsefSzikszai
Active Contributor
0 Likes
1,082

hi,

did you try?

SELECT ...

WHERE ( field EQ a OR field EQ b )

or is it not your question?

ec

Read only

Former Member
0 Likes
1,083

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').

Read only

Former Member
0 Likes
1,082

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

Read only

vinod_vemuru2
Active Contributor
0 Likes
1,082

Hi,

Yes we can do it using IN operator.

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

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

AND....

Thanks,

Vinod.

Read only

Former Member
0 Likes
1,082

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

Read only

Former Member
0 Likes
1,082

Hi!

SELECT * FROM mara

INTO TABLE gt_mara

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

Regards

Tamá

Read only

Former Member
0 Likes
1,082

Hi,

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

Best regards,

Prashant

Read only

Former Member
0 Likes
1,082

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