2008 Jul 23 3:12 AM
Hello Experts,
I am trying to write a below code where i will be using JOIN statment to select data from 2 table faglflexas and cepct.These two tables have only one field in common(prctr).I would also be getting the value of prctr from the user on selection screen.
But the code syntax is not allowing me to prctr in both the places.
SELECT faglflexapoper faglflexaryear faglflexaprctr cepctktext " FROM faglflexa
INTO CORRESPONDING FIELDS OF TABLE gi_prctr
FROM cepct JOIN faglflexa ON cepctprctr = faglflexaprctr
WHERE poper IN s_period
AND ryear EQ p_fyear.
AND prctr in s_prctr.
I am getting error in last line of AND prctr in s_prctr. asking that I prctr is defined in two places in the select query.
please help.
points will be rewarded definately.
2008 Jul 23 3:17 AM
Hi,
The code written by you is giving a syntax error as PRCTR field is present in both the tables and you are using a join but in the where clause you are not specifying the field with respect to a table.
try the below syntax:
SELECT faglflexapoper faglflexaryear faglflexaprctr cepctktext " FROM faglflexa
INTO CORRESPONDING FIELDS OF TABLE gi_prctr
FROM cepct JOIN faglflexa ON cepctprctr = faglflexaprctr
WHERE poper IN s_period
AND ryear EQ p_fyear.
AND cepct~prctr in s_prctr.
Thanks.
2008 Jul 23 3:17 AM
Hi,
The code written by you is giving a syntax error as PRCTR field is present in both the tables and you are using a join but in the where clause you are not specifying the field with respect to a table.
try the below syntax:
SELECT faglflexapoper faglflexaryear faglflexaprctr cepctktext " FROM faglflexa
INTO CORRESPONDING FIELDS OF TABLE gi_prctr
FROM cepct JOIN faglflexa ON cepctprctr = faglflexaprctr
WHERE poper IN s_period
AND ryear EQ p_fyear.
AND cepct~prctr in s_prctr.
Thanks.
2008 Jul 23 3:23 AM
2008 Jul 23 3:19 AM
Try this way
SELECT faglflexa~poper faglflexa~ryear faglflexa~prctr cepct~ktext " FROM faglflexa
INTO CORRESPONDING FIELDS OF TABLE gi_prctr
FROM cepct INNER JOIN faglflexa ON cepct~prctr = faglflexa~prctr
WHERE faglflexa~poper IN s_period
AND faglflexa~ryear EQ p_fyear.
AND faglflexa~prctr in s_prctr.
2008 Jul 23 3:22 AM
Hi,
there is small mistake in your query, just try this one.
SELECT faglflexapoper faglflexaryear faglflexaprctr cepctktext " FROM faglflexa
INTO CORRESPONDING FIELDS OF TABLE gi_prctr
FROM cepct JOIN faglflexa ON cepctprctr = faglflexaprctr
WHERE poper IN s_period
AND ryear EQ p_fyear.
AND faglflexa~prctr in s_prctr.
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |