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

using 3 tables in join condition

Former Member
0 Likes
934

hi

can anyone tell me if there is any way of using three tables in a single inner join condition.

its urgent

8 REPLIES 8
Read only

Former Member
0 Likes
902

Hi,

Yes there is a way to use three tables in an inner join select.

Try using your F1 key to view the help and failing that, SEARCH these forums. There is lots of information about using inner joins.

Gareth.

Read only

0 Likes
902

can u please provide me a sample select stmt using 3tables please.

very very urgent

Read only

0 Likes
902

Can you please learn to SEARCH. That is more urgent from where I am sitting...

Read only

Former Member
0 Likes
902

Hi,

*"Table declarations...................................................

TABLES:
  spfli,
  sflight,
  sbook.
*  scustom.

*"Selection screen elements............................................
SELECT-OPTIONS:
  s_carrid FOR sflight-carrid.

*" Data declarations...................................................
*"--------------------------------------------------------------------*
* Work variables                                                      *
*"--------------------------------------------------------------------*
DATA: w_carrid TYPE s_carr_id,
      w_fldate TYPE s_date.

*" Type declarations...................................................
*"--------------------------------------------------------------------*
* Type declaration of the structure to hold Airline data              *
*"--------------------------------------------------------------------*
TYPES:
  BEGIN OF type_s_flight,
    carrid    TYPE spfli-carrid,       " AIRLINE CODE
    connid    TYPE spfli-connid,       " FLIGHT CONNECTION NUMBER
    cityfrom  TYPE spfli-cityfrom,     " DEPARTURE CITY
    fldate    TYPE sflight-fldate,     " FLIGHT DATE
    price     TYPE sflight-price,      " AIRFARE
    bookid    TYPE sbook-bookid,       " BOOKING NUMBER
    name      TYPE scustom-name,       " CUSTOMER NUMBER
  END OF type_s_flight.

*"--------------------------------------------------------------------*
* Work area to hold airline header data                               *
*"--------------------------------------------------------------------*
DATA:
  fs_flight TYPE type_s_flight.
*"--------------------------------------------------------------------*
* Internal table to hold Airline header data                          *
*"--------------------------------------------------------------------*
DATA:
 t_flight TYPE
 STANDARD TABLE
       OF type_s_flight.

SELECT a~carrid
       a~connid
       a~cityfrom
       b~fldate
       b~price
       c~bookid
  INTO TABLE t_flight
  FROM spfli AS a
  INNER JOIN sflight AS b
  ON   a~connid = b~connid
  INNER JOIN sbook AS c
  ON   b~fldate = c~fldate
  WHERE a~carrid IN s_carrid.


LOOP AT t_flight INTO fs_flight.
  WRITE:/
   fs_flight-fldate,
   fs_flight-price,
   fs_flight-bookid,
   fs_flight-carrid,
   fs_flight-connid,
   fs_flight-cityfrom.
ENDLOOP.                               " LOOP AT T_FLIGHT

Regards

Adil

Edited by: Syed Abdul Adil on Jun 24, 2008 2:04 PM

Read only

0 Likes
902

hi

can u tell me the select stmt using joins for the following thing. i am not able to create a join.there's some error when i am doing the same.

the following statmt there are duplicate records coming.so when i sort and delete them in the next selects stmt the description text is coming at the end of the 1st select.

select pcomponent pEXTRELEASE prelease fPATCH f~patch_type

into corresponding fields of table fintab from cvers as p inner join pat03 as f

on pcomponent = faddon_id.

select kdesc_text kcomponent into corresponding fields of table fintab from cvers_ref as k inner join cvers as l

on kcomponent = lcomponent where k~LANGU = 'EN'.

2) using joins for 3tables.

select pcomponent pEXTRELEASE p~release

fPATCH fpatch_type

k~desc_text

into corresponding fields of table fintab

from cvers as p

inner join pat03 as f

on pcomponent = faddon_id

inner join

cvers_ref as k innerjoin

cvers as l on kcomponent = lcomponent where k~LANGU = 'EN'.

let me know if anyone can help me on this.

i need to gv the report EOD today.

Read only

0 Likes
902

hi \

thanks alot...

i am done with the things........

Read only

Former Member
0 Likes
902

Hi,

Yes three tables can be joined.

Plz check if this is what you need.

SELECT a~representative

a~selection_id

a~sub_date

a~sub_time

a~superior

a~team

a~status

FROM zo9_user_status AS a

INNER JOIN zo9_user AS b

ON aselection_id = bselectionid

INNER JOIN zo9_user_add AS c

ON aselection_id = cselectionid

INTO TABLE g_t_zo9_user_status

WHERE a~representative = g_t_zo9_user_roles- representative

AND a~selection_id = g_t_zo9_user_roles-selection_id

AND a~sub_date <= g_date

AND a~sub_date >= g_date_from

AND a~status IN r_status

AND b~pareaid = g_parea

AND c~iobjnm = c_country

AND c~low = g_soldto_country.

Hope this helps you.

Plz reward if useful.

Thanks,

Dhanashri.

Edited by: Dhanashri Pawar on Jun 24, 2008 1:59 PM

Read only

Former Member
0 Likes
902

Hi,

Plz check if this is what you need.

SELECT a~representative

a~selection_id

a~sub_date

a~sub_time

a~superior

a~team

a~status

FROM zo9_user_status AS a

INNER JOIN zo9_user AS b

ON aselection_id = bselectionid

INNER JOIN zo9_user_add AS c

ON aselection_id = cselectionid

INTO TABLE g_t_zo9_user_status

WHERE a~representative = g_t_zo9_user_roles- representative

AND a~selection_id = g_t_zo9_user_roles-selection_id

AND a~sub_date <= g_date

AND a~sub_date >= g_date_from

AND a~status IN r_status

AND b~pareaid = g_parea

AND c~iobjnm = c_country

AND c~low = g_soldto_country.

Hope this helps you.

Plz reward if useful.

Thanks,

Dhanashri.