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

How to fetch data where reference with two values

Former Member
0 Likes
602

Hello Gurus,

How to fetch data from database table with two values for reference. like

         SELECT  < FIELDS>

                          FROM <DB>

                          INTO TABLE TAB2

                          FOR ALL ENTRIES IN

                          TAB1

                          WHERE

                           FIELD1 = TAB1-FIELD1 AND

                           FIELD1 =  TAB1-FIELD2.

Hello Gurus,

How to fetch data from database table with two values for reference. like

         SELECT  < FIELDS>

                          FROM <DB>

                          INTO TABLE TAB2

                          FOR ALL ENTRIES IN

                          TAB1

                          WHERE

                           FIELD1 = TAB1-FIELD1 AND

                           FIELD1 =  TAB1-FIELD2.

1 REPLY 1
Read only

Former Member
0 Likes
509

Hi,

If you want to get data for both fields then Instead of AND use OR

        SELECT  < FIELDS> 

                          FROM <DB>

                          INTO TABLE TAB2

                          FOR ALL ENTRIES IN

                          TAB1

                          WHERE

                           FIELD1 = TAB1-FIELD1 OR

                           FIELD1 =  TAB1-FIELD2.

Or if you want that only common data for both fields should be fetched then create new internal table. Append data of both fields into that table. Sort new table and do delete adjust duplicate. Now use new internal table in your select query.

Let me know if this helps.

Regards,

Jigar Thakkar.