Inner Join Error?
Hi Guys ,
when i am using InnerJoin i am getting Error like
"For pooled tables ,Cluster tables and Projection Views Join is not allowed"
The code is below
Select * into table it_regup
From regup as a inner join bkpf as b on aBELNR = bBELNR.
Thanks,
Gopi.
Gopi,
You can only use join with transparant tables. Since RESUP is a cluster table you will get error. Try the other solution which has been discussed in your other post.
Rgds,
Naren
Similar Messages
-
Select SUM( ) in inner join - error in code
Hi All,
The following code is using ABAP OO and I get the following error
E:The addition "FOR ALL ENTRIES" excludes all aggregate functions with
the exception of "COUNT( * )", as the single element of the SELECT
clause.
Here is the Code:
select a/bic/ZEDM_ENTP amaterial a~/bic/zedm_stid
a/bic/ZEDM_SDT a/bic/ZEDM_MINH a~/bic/ZEDM_EHD
SUM( b~/bic/ZEDM_QPLN )
c~/bic/ZDEMQTY
from /bic/azdrp_1900 as a inner join /bic/azdrp_0400 as b
on
a/bic/ZEDM_ENTP = b/bic/ZEDM_ENTP and
amaterial = bmaterial and
a/bic/zedm_stid = bplant and
a/bic/ZEDM_SDT = b/bic/zedm_pshp
inner join /bic/azrp_0800 as C
on
amaterial = cmaterial and
a/bic/zedm_stid = c/bic/zedm_stid and
a/bic/ZEDM_SDT = c/bic/ZEDM_ESDT
into table z_it_inv for all entries in
RESULT_PACKAGE where
a~/bic/ZEDM_ENTP = RESULT_PACKAGE-/bic/ZEDM_ENTP
and a~material = RESULT_PACKAGE-material
and a~/bic/ZEDM_SDT = RESULT_PACKAGE-/BIC/OIZEDM_EDT
and a~/bic/zedm_stid = RESULT_PACKAGE-/BIC/OIZEDM_TOST
group by b/bic/ZEDM_ENTP bmaterial b~plant
b~/bic/zedm_pshp
Can you please tell me how to correct this?
ThanksHi,
You can get all records first and then LOOP AT Internal table and use COLLECT statement to sum up required column.
This will be a better idea than trying to use SUM in SELECT with JOINS.
ashish -
Inner Join resulting in many, many duplicates
I ran an Inner Join but it returned many, many duplicates. Any idea why that would occur?
One Answer from a different thread:
Because you may be having improper Join condition what has a One to many or a Many to many relationship between the tables. We do not have the data, and hence cannot comment over it. However, since the original issue is resolved, I suggest you close this thread and ask the question in another thread.
What do I look for to identify an improper join?Please don't start another discussion for the same issue.
Continue on your existing thread where the answers and advice you've already been given can be seen, so that people don't end up giving the same advice you've already had.
Answers on other thread: Inner Join error
Locking this thread -
Urgent help please. Inner Join caused ora-00933 error
I ran this one , works fine:
SELECT DISTINCT EXP.EXP_ID,
EXP.DATU_EXP_WIRE_CENTER_CLLI,
EXP.DATU_EXP_IP,
EXP.DATU_EXP_CLLI,
EXP.DATU_EXP_PORT,
EXP.DATU_EXP_NAME,
EXP.DATU_EXP_CITY,
EXP.DATU_EXP_STATE,
EXP.DATU_EXP_SW_VERSION,
DECODE(LAST_ALARM.LAST_ALARM_DATE, NULL, TO_CHAR(SYSDATE,'YYYY/MM/DD HH24:MI:SS'),
TO_CHAR(LAST_ALARM.LAST_ALARM_DATE,'YYYY/MM/DD HH24:MI:SS')) AS STATUS_DATE,
DECODE(LAST_ALARM.ALARM_NAME, NULL, 'Disconnected', LAST_ALARM.ALARM_NAME) AS DATU_STATUS,
DECODE(LAST_ALARM.ALARM_CLASS, NULL, 'OTHER', LAST_ALARM.ALARM_CLASS) AS IS_ERROR_STATUS,
DECODE(LAST_RESOURCE.LAST_ALARM_DATE, NULL, '', TO_CHAR(LAST_RESOURCE.LAST_ALARM_DATE,'YYYY/MM/DD HH24:MI:SS')) AS RESOURCE_STATUS_DATE,
DECODE(LAST_RESOURCE.RESOURCE_CODE_NAME, NULL, '', LAST_RESOURCE.RESOURCE_CODE_NAME) AS RESOURCE_STATUS,
DECODE(LAST_RESOURCE.RESOURCE_CODE_CLASS, NULL, '', LAST_RESOURCE.RESOURCE_CODE_CLASS) AS IS_RESOURCE_ERROR_STATUS,
DECODE(LAST_OPER.LAST_ALARM_DATE, NULL, '', TO_CHAR(LAST_OPER.LAST_ALARM_DATE,'YYYY/MM/DD HH24:MI:SS')) AS OPER_STATUS_DATE,
DECODE(LAST_OPER.OPER_CODE_NAME, NULL, '', LAST_OPER.OPER_CODE_NAME) AS OPER_STATUS,
DECODE(LAST_OPER.OPER_CODE_CLASS, NULL, '', LAST_OPER.OPER_CODE_CLASS) AS IS_OPER_ERROR_STATUS,
EXP.BEGIN_MAINT_WINDOW, RTU.RTU_NAME
FROM TT_DATU_EXP_UNIT_INFO EXP
left outer join
( SELECT distinct alarmed_datus.EXP_ID, c.ALARM_NAME, c.ALARM_TYPE, c.ALARM_CLASS, alarmed_datus.LAST_ALARM_DATE
FROM ( SELECT EXP_ID, MAX(ALARM_TIME) AS LAST_ALARM_DATE FROM TT_DATU_EXP_ALARM_INFO GROUP BY EXP_ID ) alarmed_datus
inner join TT_DATU_EXP_ALARM_INFO b on b.EXP_ID = alarmed_datus.EXP_ID AND b.ALARM_TIME = alarmed_datus.LAST_ALARM_DATE
inner join TT_DATU_EXP_ALARM_TYPES c on b.ALARM_TYPE = c.ALARM_TYPE
) LAST_ALARM on EXP.EXP_ID = LAST_ALARM.EXP_ID
left outer join
( SELECT distinct a.EXP_ID, c.RESOURCE_CODE_NAME, c.RESOURCE_CODE_TYPE, c.RESOURCE_CODE_CLASS, a.LAST_ALARM_DATE
FROM ( SELECT EXP_ID, MAX(RESOURCE_CODE_TIME) AS LAST_ALARM_DATE
FROM TT_DATU_EXP_RESOURCE_CODE_INFO GROUP BY EXP_ID ) a
inner join TT_DATU_EXP_RESOURCE_CODE_INFO b on b.EXP_ID = a.EXP_ID AND b.RESOURCE_CODE_TIME = a.LAST_ALARM_DATE
inner join TT_DATU_EXP_RESOURCECODE_TYPES c on b.RESOURCE_CODE_TYPE = c.RESOURCE_CODE_TYPE
) LAST_RESOURCE on EXP.EXP_ID = LAST_RESOURCE.EXP_ID
left outer join
( SELECT distinct a.EXP_ID, c.OPER_CODE_NAME, c.OPER_CODE_TYPE, c.OPER_CODE_CLASS, a.LAST_ALARM_DATE
FROM ( SELECT EXP_ID, MAX(OPER_CODE_TIME) AS LAST_ALARM_DATE
FROM TT_DATU_EXP_OPER_CODE_INFO GROUP BY EXP_ID ) a
inner join TT_DATU_EXP_OPER_CODE_INFO b on b.EXP_ID = a.EXP_ID AND b.OPER_CODE_TIME = a.LAST_ALARM_DATE
inner join TT_DATU_EXP_OPER_CODE_TYPES c on b.OPER_CODE_TYPE = c.OPER_CODE_TYPE) LAST_OPER on EXP.EXP_ID = LAST_OPER.EXP_ID
inner join TT_DATU_LRN_MAP LRNS on EXP.EXP_ID = LRNS.EXP_ID AND TRIM(LRNS.LRN) LIKE p_LRN
inner join TT_RTU_TYPES RTU ON EXP.RTU_TYPE_ID = RTU.RTU_TYPE_ID
WHERE NOT EXISTS (SELECT SATELLITE_EXP_ID FROM TT_HOST_SATELLITE WHERE EXP.EXP_ID = SATELLITE_EXP_ID)
AND EXP.IS_PRIMARY_ADDRESS LIKE p_isPrimary;
ELSE
OPEN v_cursor FOR
SELECT EXP.EXP_ID,
EXP.DATU_EXP_WIRE_CENTER_CLLI,
EXP.DATU_EXP_IP,
EXP.DATU_EXP_CLLI,
EXP.DATU_EXP_PORT,
EXP.DATU_EXP_NAME,
EXP.DATU_EXP_CITY,
EXP.DATU_EXP_STATE,
EXP.DATU_EXP_SW_VERSION,
DECODE(LAST_ALARM.LAST_ALARM_DATE, NULL, TO_CHAR(SYSDATE,'YYYY/MM/DD HH24:MI:SS'), TO_CHAR(LAST_ALARM.LAST_ALARM_DATE,'YYYY/MM/DD HH24:MI:SS')) AS STATUS_DATE,
DECODE(LAST_ALARM.ALARM_NAME, NULL, 'Disconnected', LAST_ALARM.ALARM_NAME) AS DATU_STATUS,
DECODE(LAST_ALARM.ALARM_CLASS, NULL, 'OTHER', LAST_ALARM.ALARM_CLASS) AS IS_ERROR_STATUS,
DECODE(LAST_RESOURCE.LAST_ALARM_DATE, NULL, '', TO_CHAR(LAST_RESOURCE.LAST_ALARM_DATE,'YYYY/MM/DD HH24:MI:SS')) AS RESOURCE_STATUS_DATE,
DECODE(LAST_RESOURCE.RESOURCE_CODE_NAME, NULL, '', LAST_RESOURCE.RESOURCE_CODE_NAME) AS RESOURCE_STATUS,
DECODE(LAST_RESOURCE.RESOURCE_CODE_CLASS, NULL, '', LAST_RESOURCE.RESOURCE_CODE_CLASS) AS IS_RESOURCE_ERROR_STATUS,
DECODE(LAST_OPER.LAST_ALARM_DATE, NULL, '', TO_CHAR(LAST_OPER.LAST_ALARM_DATE,'YYYY/MM/DD HH24:MI:SS')) AS OPER_STATUS_DATE,
DECODE(LAST_OPER.OPER_CODE_NAME, NULL, '', LAST_OPER.OPER_CODE_NAME) AS OPER_STATUS,
DECODE(LAST_OPER.OPER_CODE_CLASS, NULL, '', LAST_OPER.OPER_CODE_CLASS) AS IS_OPER_ERROR_STATUS,
EXP.BEGIN_MAINT_WINDOW, RTU.RTU_NAME
FROM TT_DATU_EXP_UNIT_INFO EXP
left outer join (
SELECT distinct alarmed_datus.EXP_ID, c.ALARM_NAME, c.ALARM_TYPE, c.ALARM_CLASS, alarmed_datus.LAST_ALARM_DATE
FROM (SELECT EXP_ID, MAX(ALARM_TIME) AS LAST_ALARM_DATE FROM TT_DATU_EXP_ALARM_INFO GROUP BY EXP_ID ) alarmed_datus
inner join TT_DATU_EXP_ALARM_INFO b on b.EXP_ID = alarmed_datus.EXP_ID AND b.ALARM_TIME = alarmed_datus.LAST_ALARM_DATE
inner join TT_DATU_EXP_ALARM_TYPES c on b.ALARM_TYPE = c.ALARM_TYPE )
LAST_ALARM on EXP.EXP_ID = LAST_ALARM.EXP_ID
left outer join
( SELECT distinct a.EXP_ID, c.RESOURCE_CODE_NAME, c.RESOURCE_CODE_TYPE, c.RESOURCE_CODE_CLASS, a.LAST_ALARM_DATE
FROM ( SELECT EXP_ID, MAX(RESOURCE_CODE_TIME) AS LAST_ALARM_DATE
FROM TT_DATU_EXP_RESOURCE_CODE_INFO GROUP BY EXP_ID ) a
inner join TT_DATU_EXP_RESOURCE_CODE_INFO b on b.EXP_ID = a.EXP_ID AND b.RESOURCE_CODE_TIME = a.LAST_ALARM_DATE
inner join TT_DATU_EXP_RESOURCECODE_TYPES c on b.RESOURCE_CODE_TYPE = c.RESOURCE_CODE_TYPE) LAST_RESOURCE on EXP.EXP_ID = LAST_RESOURCE.EXP_ID
left outer join
( SELECT distinct a.EXP_ID, c.OPER_CODE_NAME, c.OPER_CODE_TYPE, c.OPER_CODE_CLASS, a.LAST_ALARM_DATE
FROM ( SELECT EXP_ID, MAX(OPER_CODE_TIME) AS LAST_ALARM_DATE
FROM TT_DATU_EXP_OPER_CODE_INFO GROUP BY EXP_ID ) a
inner join TT_DATU_EXP_OPER_CODE_INFO b on b.EXP_ID = a.EXP_ID AND b.OPER_CODE_TIME = a.LAST_ALARM_DATE
inner join TT_DATU_EXP_OPER_CODE_TYPES c on b.OPER_CODE_TYPE = c.OPER_CODE_TYPE
) LAST_OPER on EXP.EXP_ID = LAST_OPER.EXP_ID ORDER BY EXP.DATU_EXP_CLLI
inner join TT_RTU_TYPES RTU ON EXP.RTU_TYPE_ID = RTU.RTU_TYPE_ID
WHERE NOT EXISTS (SELECT SATELLITE_EXP_ID FROM TT_HOST_SATELLITE WHERE EXP.EXP_ID = SATELLITE_EXP_ID) AND EXP.IS_PRIMARY_ADDRESS like
p_isPrimary;
However this one:
SELECT EXP.EXP_ID,
EXP.DATU_EXP_WIRE_CENTER_CLLI,
EXP.DATU_EXP_IP,
EXP.DATU_EXP_CLLI,
EXP.DATU_EXP_PORT,
EXP.DATU_EXP_NAME,
EXP.DATU_EXP_CITY,
EXP.DATU_EXP_STATE,
EXP.DATU_EXP_SW_VERSION,
DECODE(LAST_ALARM.LAST_ALARM_DATE, NULL, TO_CHAR(SYSDATE,'YYYY/MM/DD HH24:MI:SS'),
TO_CHAR(LAST_ALARM.LAST_ALARM_DATE,'YYYY/MM/DD HH24:MI:SS')) AS STATUS_DATE,
DECODE(LAST_ALARM.ALARM_NAME, NULL, 'Disconnected', LAST_ALARM.ALARM_NAME) AS DATU_STATUS,
DECODE(LAST_ALARM.ALARM_CLASS, NULL, 'OTHER', LAST_ALARM.ALARM_CLASS) AS IS_ERROR_STATUS,
DECODE(LAST_RESOURCE.LAST_ALARM_DATE, NULL, '', TO_CHAR(LAST_RESOURCE.LAST_ALARM_DATE,'YYYY/MM/DD HH24:MI:SS')) AS RESOURCE_STATUS_DATE,
DECODE(LAST_RESOURCE.RESOURCE_CODE_NAME, NULL, '', LAST_RESOURCE.RESOURCE_CODE_NAME) AS RESOURCE_STATUS,
DECODE(LAST_RESOURCE.RESOURCE_CODE_CLASS, NULL, '', LAST_RESOURCE.RESOURCE_CODE_CLASS) AS IS_RESOURCE_ERROR_STATUS,
DECODE(LAST_OPER.LAST_ALARM_DATE, NULL, '', TO_CHAR(LAST_OPER.LAST_ALARM_DATE,'YYYY/MM/DD HH24:MI:SS')) AS OPER_STATUS_DATE,
DECODE(LAST_OPER.OPER_CODE_NAME, NULL, '', LAST_OPER.OPER_CODE_NAME) AS OPER_STATUS,
DECODE(LAST_OPER.OPER_CODE_CLASS, NULL, '', LAST_OPER.OPER_CODE_CLASS) AS IS_OPER_ERROR_STATUS,
EXP.BEGIN_MAINT_WINDOW, RTU.RTU_NAME
FROM TT_DATU_EXP_UNIT_INFO EXP
left outer join
SELECT distinct alarmed_datus.EXP_ID, c.ALARM_NAME, c.ALARM_TYPE, c.ALARM_CLASS, alarmed_datus.LAST_ALARM_DATE
FROM ( SELECT EXP_ID, MAX(ALARM_TIME) AS LAST_ALARM_DATE FROM TT_DATU_EXP_ALARM_INFO GROUP BY EXP_ID) alarmed_datus
inner join TT_DATU_EXP_ALARM_INFO b on b.EXP_ID = alarmed_datus.EXP_ID AND b.ALARM_TIME = alarmed_datus.LAST_ALARM_DATE
inner join TT_DATU_EXP_ALARM_TYPES c on b.ALARM_TYPE = c.ALARM_TYPE ) LAST_ALARM on EXP.EXP_ID = LAST_ALARM.EXP_ID
left outer join
( SELECT distinct a.EXP_ID, c.RESOURCE_CODE_NAME, c.RESOURCE_CODE_TYPE, c.RESOURCE_CODE_CLASS, a.LAST_ALARM_DATE
FROM ( SELECT EXP_ID, MAX(RESOURCE_CODE_TIME) AS LAST_ALARM_DATE
FROM TT_DATU_EXP_RESOURCE_CODE_INFO GROUP BY EXP_ID ) a
inner join TT_DATU_EXP_RESOURCE_CODE_INFO b on b.EXP_ID = a.EXP_ID AND b.RESOURCE_CODE_TIME = a.LAST_ALARM_DATE
inner join TT_DATU_EXP_RESOURCECODE_TYPES c on b.RESOURCE_CODE_TYPE = c.RESOURCE_CODE_TYPE) LAST_RESOURCE on EXP.EXP_ID = LAST_RESOURCE.EXP_ID
left outer join
( SELECT distinct a.EXP_ID, c.OPER_CODE_NAME, c.OPER_CODE_TYPE, c.OPER_CODE_CLASS, a.LAST_ALARM_DATE
FROM ( SELECT EXP_ID, MAX(OPER_CODE_TIME) AS LAST_ALARM_DATE
FROM TT_DATU_EXP_OPER_CODE_INFO GROUP BY EXP_ID ) a
inner join TT_DATU_EXP_OPER_CODE_INFO b on b.EXP_ID = a.EXP_ID AND b.OPER_CODE_TIME = a.LAST_ALARM_DATE
inner join TT_DATU_EXP_OPER_CODE_TYPES c on b.OPER_CODE_TYPE = c.OPER_CODE_TYPE
) LAST_OPER on EXP.EXP_ID = LAST_OPER.EXP_ID ORDER BY EXP.DATU_EXP_CLLI
inner join TT_RTU_TYPES RTU ON EXP.RTU_TYPE_ID = RTU.RTU_TYPE_ID
WHERE EXP.IS_PRIMARY_ADDRESS like p_isPrimary;
this one not work kept giving me errors:
[ ORA-00933: SQL command not properly ended
Any guru can help? I need to have this resolved end of today.
Thanks in advance.Hi,
Never write, let alone post, unformatted code.
Indent the code so that it's easy to set the scope of sub-queries, and the majoc clauses (SELECT, FROM, WHERE, ORDER BY, ...) in each.
When posting any formatted text on this site, type these 6 characters:
\(small letters only, inside curly brackets) before and after each section of formatted text, to preserve spacing.
If you do that to the code you posted, you'll see that it ends like this:... inner join TT_DATU_EXP_OPER_CODE_INFO b on b.EXP_ID = a.EXP_ID
AND b.OPER_CODE_TIME = a.LAST_ALARM_DATE
inner join TT_DATU_EXP_OPER_CODE_TYPES c on b.OPER_CODE_TYPE = c.OPER_CODE_TYPE
) LAST_OPER on EXP.EXP_ID = LAST_OPER.EXP_ID
ORDER BY EXP.DATU_EXP_CLLI
inner join TT_RTU_TYPES RTU ON EXP.RTU_TYPE_ID = RTU.RTU_TYPE_ID
WHERE EXP.IS_PRIMARY_ADDRESS like p_isPrimary
You can't put an ORDER BY clause in the middle of the FROM clause.
The ORDER BY clause always goes after the WHERE clause, like this:... inner join TT_DATU_EXP_OPER_CODE_INFO b on b.EXP_ID = a.EXP_ID
AND b.OPER_CODE_TIME = a.LAST_ALARM_DATE
inner join TT_DATU_EXP_OPER_CODE_TYPES c on b.OPER_CODE_TYPE = c.OPER_CODE_TYPE
) LAST_OPER on EXP.EXP_ID = LAST_OPER.EXP_ID
inner join TT_RTU_TYPES RTU ON EXP.RTU_TYPE_ID = RTU.RTU_TYPE_ID
WHERE EXP.IS_PRIMARY_ADDRESS like p_isPrimary
ORDER BY EXP.DATU_EXP_CLLI -
Error in inner join when i am using 3 tables to join..
hi,
why error is giving when i am joining 3 tables ..
tables : lfa1,lfb1,lfm1.
types : begin of ty_lfa1,
lifnr type lfa1-lifnr,
name1 type lfa1-name1,
bukrs type lfb1-bukrs,
erdat type lfm1-erdat,
end of ty_lfa1.
data : i_lfa1 type ty_lfa1 occurs 1.
select a~lifnr
a~name1
b~bukrs
m~erdat
into table i_lfa1
from ((lfa1 as a inner join lfb1 as b on alifnr = blifnr) inner join lfm1 as m on alifnr = mlifnr).
error : The table name "((LFA1 AS A INNER JOIN LFB1 AS B ON ALIFNR = BLIFNR)
INNER JOIN LFM1 AS M ON ALIFNR = MLIFNR)" is too long . unique.
unique. unique. unique. unique. unique.
plz help me ...why it is showing..
thanks & regards ,
kalyanHi Kalyan,
Do it this way: In your code just give the space between ( & ( & lfa1 and also at the end ~lifnr )
select a~lifnr
a~name1
b~bukrs
m~erdat
into table i_lfa1
from ( ( lfa1 as a inner join lfb1 as b on a~lifnr eq b~lifnr ) " maintain a space bwteen ( and field
inner join lfm1 as m on a~lifnr eq m~lifnr ).
or
select a~lifnr
a~name1
b~bukrs
m~erdat
into table i_lfa1
from lfa1 as a inner join lfb1 as b
on a~lifnr eq b~lifnr
inner join lfm1 as m
on a~lifnr eq m~lifnr.
With luck,
Pritam.
Edited by: Pritam Ghosh on Jan 13, 2009 2:31 PM -
ORA-00947 Error on straight SELECT with INNER JOINs
I have a REAL bizarre situation. I have a SQL SELECT Statement that is joining a few tables. I actually have a WHERE clause where I am filtering by a coulmn within one of the joins. However, if I try to SELECT that coulmn, I am getting an Oracle error ORA-00947. I can even SELECT * and get ALL the columns back form ALL the tables I'm joing on, including the one that is not allowing me just to select it.
Has anyone ever seen anything like this before???
I appreciate your review and am hopeful for a reply.
Thanks.
PSULionRPJez....Not sure if I need to worry about proprietary stuff here...Here's the SQL and the column I'm trying to select is CDM_SUPPLIER_UTILITY.SUPPLIER_CD.
When I do that is when I get the ORA-00947 error. And our version is...
Oracle9i Enterprise Edition Release 9.2.0.8.0 - 64bit Production
SELECT CDM_CALENDAR.CALENDAR_DT,
CDM_OFFER.SUPPLIER_NAME,
CDM_SUPPLIER_UTILITY.SUPPLIER_CD,
ABS(SUM(CDM_MONEY.TRANSACTION_AMT))
FROM CDEDM.CDM_TRANSACTIONS CDM_TRANSACTIONS
INNER JOIN CDEDM.CDM_MONEY CDM_MONEY
ON CDM_MONEY.TRANSACTION_FK = CDM_TRANSACTIONS.TRANSACTION_GK_PK
INNER JOIN CDEDM.CDM_OFFER CDM_OFFER
ON CDM_OFFER.OFFER_GK_PK = CDM_MONEY.OFFER_FK
INNER JOIN CDEDM.CDM_CALENDAR CDM_CALENDAR
ON CDM_CALENDAR.CALENDAR_DT_PK = CDM_MONEY.TRANSACTION_DT_FK
INNER JOIN CDEDM.CDM_BILL_ACCOUNTS CDM_BILL_ACCOUNTS
ON CDM_BILL_ACCOUNTS.BILL_ACCT_GK_PK = CDM_MONEY.BILL_ACCOUNTS_FK
INNER JOIN CDEDM.CDM_SUPPLIER_UTILITY CDM_SUPPLIER_UTILITY
ON CDM_SUPPLIER_UTILITY.SUPPLIER_UTILITY_GK_PK = CDM_BILL_ACCOUNTS.SUPPLIER_FK
WHERE CDM_SUPPLIER_UTILITY.SUPPLIER_CD = 'MC2'
AND CDM_CALENDAR.CALENDAR_DT BETWEEN NEXT_DAY(trunc(SYSDATE-12),'Saturday')
AND NEXT_DAY(trunc(SYSDATE-5),'Saturday')
AND CDM_TRANSACTIONS.TRAN_DECODE IN
'Debit/Bill Installment Billing',
'Debit/Bill Electric Service',
'Debit by Transfer of Payment TO Uncollec',
'Debit Miscellaneous Electric',
'Credit for Transfer TO Uncollectible',
'Credit for Tranfer FROM Uncollectible',
'Credit Miscellaneous Electric',
'Credit Alteration',
'Credit Allowance',
'Bill Consumption On An Inactive Meter'
AND CDM_MONEY.TRANSACTION_LEVEL_CD IN
'A',
GROUP BY CDM_CALENDAR.CALENDAR_DT,
CDM_OFFER.SUPPLIER_NAME,
CDM_SUPPLIER_UTILITY.SUPPLIER_CD -
Hi i wrote the following querry but getting error
Comma without preceding colon (after SELECT ?).
the queerry is like this
SELECT ekko~lifnr
lfa1~adrnr
adr6~smtp_addr
into ( l_lifnr, l_adrnr, l_smtp_addr )
from ( ( ekko inner join lfa1 as lfa1 on ekko1~lifnr = lfa1~lifnr )
inner join adr6 as adr6 on lfa1~adrnr = adr6~adrnr ).
ENDSELECT.Hi,
try like this:
make a structure taking the reqd fiedls from the mentioned tables and then make a internal table e.g it_a
SELECT ekko~lifnr
lfa1~adrnr
adr6~smtp_addr
into corresponding fields of table it_a
from ( ( ekko inner join lfa1 as lfa1 on ekko1lifnr = lfa1lifnr )
inner join adr6 as adr6 on lfa1adrnr = adr6adrnr ).
ENDSELECT.
Regards
Rajesh Kumar -
Syntax errors in update query with inner joins and sub query.
Below is the query:
UPDATE sp_CFQ_Coord_Corrections
INNER JOIN (CFQ_Coord_Corrections
INNER JOIN CFQ_Referrals ON CFQ_Coord_Corrections.CorrID = CFQ_Referrals.RecID)
ON sp_CFQ_Coord_Corrections.ID = CFQ_Referrals.RecID
SET CFQ_Coord_Corrections.MatchFound = 1,
CFQ_Coord_Corrections.RecTblID = [CFQ_Referrals].[RecTblID],
sp_CFQ_Coord_Corrections.MatchFound = 1
WHERE (((CFQ_Coord_Corrections.MatchFound)=0)
AND ((sp_CFQ_Coord_Corrections.MatchFound)=0)
AND ((CFQ_Coord_Corrections.RecImported)=1)
AND ((CFQ_Referrals.RecFileName)='COORDCORR_SPOINT')
AND ((CFQ_Referrals.RecCombKey)='No.Match')
AND ((sp_CFQ_Coord_Corrections.RecImported)=1));
Error messages seen when executed:
Msg 156, Level 15, State 1, Line 3
Incorrect syntax near the keyword 'INNER'.
Msg 102, Level 15, State 1, Line 10
Incorrect syntax near 'CFQ_Coord_Corrections'.
Please help.....Below is the query:
UPDATE sp_CFQ_Coord_Corrections
INNER JOIN (CFQ_Coord_Corrections
INNER JOIN CFQ_Referrals ON CFQ_Coord_Corrections.CorrID = CFQ_Referrals.RecID)
ON sp_CFQ_Coord_Corrections.ID = CFQ_Referrals.RecID
SET CFQ_Coord_Corrections.MatchFound = 1,
CFQ_Coord_Corrections.RecTblID = [CFQ_Referrals].[RecTblID],
sp_CFQ_Coord_Corrections.MatchFound = 1
WHERE (((CFQ_Coord_Corrections.MatchFound)=0)
AND ((sp_CFQ_Coord_Corrections.MatchFound)=0)
AND ((CFQ_Coord_Corrections.RecImported)=1)
AND ((CFQ_Referrals.RecFileName)='COORDCORR_SPOINT')
AND ((CFQ_Referrals.RecCombKey)='No.Match')
AND ((sp_CFQ_Coord_Corrections.RecImported)=1));
Error messages seen when executed:
Msg 156, Level 15, State 1, Line 3
Incorrect syntax near the keyword 'INNER'.
Msg 102, Level 15, State 1, Line 10
Incorrect syntax near 'CFQ_Coord_Corrections'.
Please help.....
sp_CFQ_Coord_Corrections is a table and not a stored procedure.
are these both tables "sp_CFQ_Coord_Corrections" and "CFQ_Coord_Corrections" different ?? -
Inner join. error. too long. unique. unique
hi,
I am a beginer to ABAP and trying to do an inner join using 3 tables that are given by SAP
scustom, spfli, and sbook. I want to join these 3 tables and get
the customer booking info and wants the result of
customer_no , cust_name, Booking_ID, City_From, City_To, etc.
my query i s below.
select cid cname bbookid bconnid bfldate fcityfrom f~cityto
into table it_scust
from ((scustom as c inner join sbook as b
on cid = bcustomid)
inner join spfli as f on fconnid = bconnid and fcarrid = bcarrid).
when i execute the program i am getting the error that the 'query is too long. unique. unique. unique.'.
If I am joing only two tables it is working fine. Is there something wrong with my query? Any ideas on this? Please help.
Thanks in advance.Hi neeraja,
what ever the code you have written is fine but it is unique/ too long means the code you have written is not ending perfectly which is not identified by syntax error. your code is
select cid cname bbookid bconnid bfldate fcityfrom f~cityto
into table it_scust
from ((scustom as c inner join sbook as b
on cid = bcustomid)
inner join spfli as f on fconnid = bconnid and fcarrid = bcarrid).
iam sending the same code but with little modification just try this u will get the output.
select cid cname bbookid bconnid bfldate fcityfrom f~cityto
into table it_scust
from (scustom as c inner join sbook as b
on cid = bcustomid)
inner join spfli as f on fconnid = bconnid and fcarrid = bcarrid.
find the difference what i made.
pls reward points if it is helpful. -
INNER JOIN, MX 7, column name error
I am running or attempting to run the att'd query in CF MX
7.0 and getting an error because I then run:
<CFOUTPUT QUERY="getNutes" group="NUTR_NO">
<CFSET VALUE = 0>
<CFOUTPUT>
<CFIF Day EQ "T">
<CFSET VALUE = VALUE + (getNutes.Total_WT *
getNutes.NUTR_VAL/100) / getDays.RecordCount>
<CFELSE>
<CFSET VALUE = VALUE + (getNutes.Total_WT *
getNutes.NUTR_VAL/100)>
</CFIF>
</CFOUTPUT>
To sum the nutrient contents...
This worked fine under CF 5... but I am getting a 'NUTR_NO
does not specify a column name in the query'.
Any thoughts???
Query follows:> Yep... it's worse... it appears that MX does not support
the sql inner join or
> outer join... sigh...
Don't be ridiculous. You're showing a fundamental lack of
understanding of
how CF handles database interaction. When you use
<cfquery> to "create" a
recordset, all CF does is resolve any embedded CF (tags,
functions,
variables, etc), and passes the resulting string to the DB.
The DB then
processes it and returns a recordset. So CF doesn't "support"
any sort of
SQL syntax. Now does it claim to; nor does it try to; nor is
it
appropriate for it to.
If you're having problems with your returned recordset, the
first thing you
should do is <cfdump> it (or part of it) and check that
you're getting back
what you're *assuming* you're getting back.
The second thing you should do is lose the SELECT *. Specify
the columns
you want back. This is nothing to do with CF, it's just
standard SELECT
query advice. When you're joining tables, you hardly ever
want ALL the
columns back, and if it's one of those rare occasions you DO
want all of
them, you should still specify a SELECT clause so you can
distinguish
between same-named columns (which seems to be your problem
here).
Adam -
Problem in Accession inner join with [Microsoft][SQLServer 2000 Driver
Hi
Can you tell me what can be cause my sql statement is correct gives result but
if i used below statement in my JSP ,cause error
1)
ps1=connection.prepareStatement("select RQM_IN_RQSTN_ID_PK,RQD_IN_ITM_ID_FKPK,RQD_VC_ITM_DSCRPTN,RQD_IN_STTS_ID_FK,C.SMT_VC_STTS_NM,a.RQM_DT_PRPSD_DLVRY_DT"+
"from PAS_RQM_RQSTN_MSTR a "+
"inner join PAS_RQD_RQSTN_DTLS b on a.RQM_IN_RQSTN_ID_PK = b.RQD_IN_RQSTN_ID_FKPK and RQD_IN_STTS_ID_FK = 4"+
"INNER JOIN PAS_SMT_STTS_MSTR C ON C.SMT_IN_STTS_ID_PK=B.RQD_IN_STTS_ID_FK" +
"where a.RQM_VC_DTRTMNT_INVLV='Technology' ");
2) Error Generate
java.sql.SQLException
[Microsoft][SQLServer 2000 Driver for JDBC][SQLServer]Line 1: Incorrect syntax near 'a'.
What can be the cause
Thanksps1=connection.prepareStatement("select
RQM_IN_RQSTN_ID_PK,RQD_IN_ITM_ID_FKPK,RQD_VC_ITM_DSCRP
TN,RQD_IN_STTS_ID_FK,C.SMT_VC_STTS_NM,a.RQM_DT_PRPSD_D
LVRY_DT"+
"from PAS_RQM_RQSTN_MSTR a "+
"inner join PAS_RQD_RQSTN_DTLS b on
a.RQM_IN_RQSTN_ID_PK = b.RQD_IN_RQSTN_ID_FKPK and
RQD_IN_STTS_ID_FK = 4"+
"INNER JOIN PAS_SMT_STTS_MSTR C ON
C.SMT_IN_STTS_ID_PK=B.RQD_IN_STTS_ID_FK" +
"where a.RQM_VC_DTRTMNT_INVLV='Technology' ");This is a problem due to not providing spaces where they are needed. See the places where I have highlighted.
A better way is to generate the String first [use StringBuffer as a good practice for appending instead of String "+"] and print it out to check if it is correct.
***Annie*** -
Link for BUT000 table and ADRC in CRM and inner join is not working in PCUI
Hi Gurus,
Please tell me the link btween BUT000 and ADRC table. and i wrote one inner join between BUT000 and BUT0id table but it not working. I m in CRM 4.0 version working with PCUI.
select but000partner but000name_org1 but000name_org2 but000bus_sort1 but0id~parnter1
but0ididnumber from but000 inner join but0id on but0idpartner = but000~parnter
into corresponding fields of table it_result where partner in s_partner.
It is giving error as partner unknown from but000 table. I delcared everything and tried with alias names also.
please clarify me.
regards,
Ramakrishna.Hi Frederic,
thanks a lot. But is inner join between BUT000 and BUT0ID will work. for me it is not working. plesae see this code.
tables : but000,
but0id,
crmm_but_custno,
adrc.
types : begin of typ_but000,
partner type bu_partner,
name_org1 type BU_NAMEOR1,
name_org2 type BU_NAMEOR2,
bu_sort1 type BU_SORT1,
idnumber type BU_ID_NUMBER,
partner1 type bu_partner,
end of typ_but000.
data: lt_but000 type table of typ_but000,
ls_but000 like line of lt_but000.
*select-options : s_partnr for but000-partner.
start-of-selection.
select but000partner but000name_org1 but000name_org2 but000bu_sort1 but0id~parnter1
but0id~idnumber into corresponding fields of table lt_but000 from but000
inner join but0id on but0idpartner = but000parnter. " where partner in s_partner.
it is giving error as but000-partner is not know or but0id-partner not known.
So, i think if it not works then i should write two select stmts.
please clarify me.
i gave u rating.
thanks
ramakrishna. -
Inner Join of 3 tables is correct or not?
Hi Guys ,
I have a requirement where i have to join 3 tables i dont know whether the inner Join which i wrote for 3 tables is correct or not.I am not getting any Syntax error but whether the logci below which i wrote gets all the records or not.
The Requirement is
"c. Select the BOL Number entered in the screen and query the table LIKP with the BOL number in the field LIKP-BOLNR. Gather the list of ALL delivery documents (LIKP-VBELN) that is outputted.
d. Query the list of the delivery documents obtained into the table VBFA in the field VBFA- VBELV. From the output that is displayed, select the Follow-On Document Field (VBFA-VBELN) for that item whose Subsequent Document Category (VBFA- VBTYP_N) is R and the Movement Type (VBFA- BWART) is 641. Get the Follow-On document number for each of the above Delivery Document number.
e. Query the table EKBE with the Follow On document obtained above in the field Material Document (EKBE- BELNR). Perform this activity for each of the follow on document obtained above. Get the resultant Purchase Order (EKBE-EBELN) and Item Number (EKBE-EBELP) from the query. After querying will all the Follow-On Documents, get the unique list of PO number and Item Number.
The logic which i wrote is
Begin of t_PoolSTO_out,
BOLNR type LIKP-BOLNR,
EBELN type EKBE-EBELN,
EBELP type EKBE-EBELP,
VBELN type LIKP-VBELN,
VBELNV type VBFA-VBELN,
End of t_PoolSTO_out.
Data: i_PoolSTO type Standard table of t_PoolSTO_out.
Select
a~BOLNR
c~EBELN
c~EBELP
a~VBELN
b~VBELN
from LIKP as a
Inner Join VBFA as b on aVBELN = bVBELV
Inner Join EKBE as c on bVBELN = cBELNR
into Table i_PoolSTO
Where a~BOLNR in S_LBLNE and
b~VBTYP_N = 'R' and
b~BWART = '641'.
My doubt is whether the logic works or not i Mean does i getall the rrecords based on the requirement.?
If not please tell any alternative logic?
Thanks,
Gopi Anne.Hi Gopi,
Your code is Good.
But try to avoid Inner join with more number of Tables ...because this is a performance issue..
try to use..
select (primary key fields mainly,other fields) from LIKP into itab where bolnr in p_bolnr(paramater).
next try to use for all entries option..
select (primary key fields mainly,other fields) from VBFA for all entries in itab where (give the condition)....
simillarly do for the other select ....ok this will try to reduce the performance issue....
<b><REMOVED BY MODERATOR></b>
Message was edited by:
Alvaro Tejada Galindo -
Help needed in rewriting the code using inner joins
Hi all,
I need help in rewriting this code
DATA : FLD LIKE ZTABLE-ZFLD,
FLD1 LIKE ZTABLE2-ZFLD2.
select single ZFLD from zTABLE1 into FLD
where MATNR = '123' and
werks = 'ABC'.
select single ZFLD1 from zTABLE2 into FLD1
where zFLD = FLD.
iS there way that we can write this with inner joins
ThanksHi,
help me out
TABLE 1 HAS
MATNR , WERKS , FLD1.
TABLE 2 HAS
FLD1, FLD2.
I KNOW MATNR AND WERKS BASED ON THAT I HAVE TO GET FLD2
I WANT IT BE WRITTEN WITH INNEWR JOINS
WITH FOLLOWING COD E I GET AN ERROR MESSAGE SAYING
comma without preccing colon (after select?)
data : FLD1 like zTABLE1-ZFLD1.
data : FLD2 like ZTABLE2-ZFLD2.
SELECT FZFLD1 BZFLD2
INTO ( FLD1, FLD2)
FROM ZTABLE1 AS F INNER JOIN ZTABLE2 AS B
ON FZFLD1 = BFLD2
WHERE F~MATNR = '123'
AND F~WERKS = 'ABC' .
Thanks -
How to use Inner join of table as Source in Merge statement in SQL
Hi All,
I am trying to make source as multiple tables output using Join while coding there is no any syntax error but when i am executing this statement is giving following error
Following is the query
Merge Into EmpDept Target
Using (select E.Address,e.Design,e.EmailId,e.EmpId,e.Ename,e.ManagerId, e.Salary,D.DeptId,D.DeptName,D.Location from Employee E Inner join Dept D on E.DeptId=D.DeptId )As Source (Address,Design,EmailId,EmpId,EName,ManagerId,Salary,DeptId,DeptName,Location)
On Source.EmpId=Target.EmpId
when not matched then
Insert (Target.Address,Target.Design,Target.EmailId,Target.EmpId,Target.Ename,Target.ManagerId, Target.Salary,Target.DeptId,Target.DeptName,Target.Location)
values
(Address,Design,EmailId,EmpId,EName,ManagerId, Salary,DeptId,DeptName,Location)
When matched then
Update set Target.Address = Source.Address ,Target.Design = Source.Design,Target.EmailId = Source.EmailId ,Target.Ename = Source.Ename ,Target.ManagerId = Source.ManagerId , Target.Salary = Source.Salary ,Target.DeptId = Source.DeptId ,Target.DeptName = Source.DeptName ,Target.Location = Source.Location;
This is error while executing the above merge statement
The insert column list used in the MERGE statement cannot contain multi-part identifiers. Use single part identifiers instead.
Please suggest me where i am wrong..
Niraj SevalkarMERGE INTO EmpDept Target
Using (SELECT E.Address,
e.Design,
e.EmailId,
e.EmpId,
e.Ename,
e.ManagerId,
e.Salary,
D.DeptId,
D.DeptName,
D.Location
FROM Employee E
INNER JOIN Dept D
ON E.DeptId = D.DeptId) AS Source (Address, Design, EmailId, EmpId, EName, ManagerId, Salary, DeptId, DeptName, Location)
ON Source.EmpId = Target.EmpId
WHEN NOT matched THEN
INSERT (Address,
Design,
EmailId,
EmpId,
Ename,
ManagerId,
Salary,
DeptId,
DeptName,
Location)
VALUES (Address,
Design,
EmailId,
EmpId,
EName,
ManagerId,
Salary,
DeptId,
DeptName,
Location)
WHEN matched THEN
UPDATE SET Address = Source.Address,
Design = Source.Design,
EmailId = Source.EmailId,
Ename = Source.Ename,
ManagerId = Source.ManagerId,
Salary = Source.Salary,
DeptId = Source.DeptId,
DeptName = Source.DeptName,
Location = Source.Location;
Maybe you are looking for
-
How to Read Statspack Report in Oracle 11.2g Standard Edition
Dear All, I am using Oracle 11.2g Standard Edition in Lab. For the performance tuning, How can i read the Statspack Report ? Please Note- I can't use the Oracle AWR feature due to License Limitation. As well as if i will generate AWR report with Orac
-
Some problems with new macbook air
Hi=) we bought new macbook air today, its nice, however few problems and if someone can help with any of them thanks a lot=) 1, magic mouse first was not scrolling, swiping and only moved/click but now after restarting macbook it doesnt work at all 2
-
Is there any way to restore contacts with no backup?
Is there any way to restore contacts with no backup on an iphone 4?
-
Continuous Integration in WebLogic Integration 9.2.2
Is anyone using Cruise Control or another type of continuous integration solution to build WLI EARs using subversion as a code repository? We're running into an issue where we can't refresh the workspace without launching workshop and doing a refresh
-
when i open a youtube video page i get several lines of text display at the top. This isn't the text normally displayed by youtube.The actual video window appears as a small black square and beneath this is the video title. The video doesn't play. Th