Join/from/where/ combine queries 3
hello my query below is not working for my cf application can
you help?
thanks
this is my previous question so i tried to do it my self.
tcase_req.tcase_req_id is added
tcase.case_id=tcase_req.case_id :note that this is not part of the
inner join in the from clause. it does not depend on the rest of
the inner join.
the reaon for this is that i need to get
WHERE tcase_req.case_req_typ_cd = cwc and
tcase_req.case_req_typ_cd = cwnc
here is the original question
Hello ,
I need help again on the inner join/and conditions in the
where clause
I have these 2 tables tcase and tcase_req where there common
field Is the case_id.
tcase is the parent table and the tcase_req is the child
table.
(1)I wanted to add this to the from clause using the inner
join table . what do I do and where do I put it
(2)I then need to put a condition in the where clause to
replace
WHERE TCASE.CASE_NBR Like '%HPOZ%'
AND TCASE.CASE_NBR = 'DIR-2004-4269-HPOZ-CCMP'
by
WHERE TCASE.CASE_NBR Like '%CWC%' or TCASE.CASE _NBR Like
'%CWNC%'
AND TCASE.CASE_NBR = 'DIR-2004-4269-CWC'
Or TCASE.CASE_NBR = 'DIR-2004-4269-CWNC'
is this efficient??
thanks
SELECT TLA_PROP.PIN,
TLA_PROP.ASSR_PRCL_NBR,
TCASE.CASE_NBR,
TLA_PROP.STR_NBR,
TLA_PROP.STR_NBR_RNG_END,
TLA_PROP.STR_FRAC_NBR,
Tref_plan_area.plan_area_desc,
TLA_PROP.STR_FRAC_NBR_RNG_END,
TLA_PROP.STR_DIR_CD,
TLA_PROP.STR_NM,
TLA_PROP.STR_SFX_CD,
TLA_PROP.STR_SFX_DIR_CD,
TLA_PROP.STR_UNIT_TYP_CD,
TLA_PROP.UNIT_NBR,
TLA_PROP.UNIT_NBR_RNG_END,
TLA_PROP.ZIP_CD,
TLA_PROP.ZIP_CD_SFX,
TLA_PROP.CNCL_DIST_NBR,
TLA_PROP.PLAN_AREA_NBR,
TLA_PROP.ZONE_REG_CD,
TAPLC.PROJ_DESC_TXT,
TCASE.CASE_ID,
TCASE.CASE_NBR,
taplc.aplc_id,
tcase_req.case_req_typ_cd
FROM TLA_PROP INNER JOIN tref_plan_area ON
tla_prop.plan_area_nbr = tref_plan_area.plan_area_NBR INNER JOIN
TLOC ON TLA_PROP.PROP_ID = TLOC.LOC_ID INNER JOIN TAPLC ON
TLOC.APLC_ID = TAPLC.APLC_ID INNER JOIN TCASE ON TAPLC.APLC_ID =
TCASE.APLC_ID
WHERE TCASE.CASE_NBR Like '%CWC%'and
tcase.case_id=tcase_req.case_id
(3)To a tcase_req
Suffix_id are equal to = cwc and cwnc ( in the tcase_req
table)(Suffix_id is the field that cintains the suffix cwc and cwnc
for the tcase_req)
also,
this is the original query and it works fine
SELECT TLA_PROP.PIN,
TLA_PROP.ASSR_PRCL_NBR,
TCASE.CASE_NBR,
TLA_PROP.STR_NBR,
TLA_PROP.STR_NBR_RNG_END,
TLA_PROP.STR_FRAC_NBR,
Tref_plan_area.plan_area_desc,
TLA_PROP.STR_FRAC_NBR_RNG_END,
TLA_PROP.STR_DIR_CD,
TLA_PROP.STR_NM,
TLA_PROP.STR_SFX_CD,
TLA_PROP.STR_SFX_DIR_CD,
TLA_PROP.STR_UNIT_TYP_CD,
TLA_PROP.UNIT_NBR,
TLA_PROP.UNIT_NBR_RNG_END,
TLA_PROP.ZIP_CD,
TLA_PROP.ZIP_CD_SFX,
TLA_PROP.CNCL_DIST_NBR,
TLA_PROP.PLAN_AREA_NBR,
TLA_PROP.ZONE_REG_CD,
TAPLC.PROJ_DESC_TXT,
TCASE.CASE_ID,
TCASE.CASE_NBR,
taplc.aplc_id
FROM TLA_PROP INNER JOIN tref_plan_area ON
tla_prop.plan_area_nbr = tref_plan_area.plan_area_NBR INNER JOIN
TLOC ON TLA_PROP.PROP_ID = TLOC.LOC_ID INNER JOIN TAPLC ON
TLOC.APLC_ID = TAPLC.APLC_ID INNER JOIN TCASE ON TAPLC.APLC_ID =
TCASE.APLC_ID
WHERE (TCASE.CASE_NBR Like '%CWC%' or TCASE.CASE_NBR Like
'%CWNC%')
For guys like us that are not writing queries everyday you
might try a query
builder like the one MS Access has.
"Coldfusionstudent" <[email protected]>
wrote in message
news:[email protected]...
> hello my query below is not working for my cf
application can you help?
> thanks
>
>
> this is my previous question so i tried to do it my
self.
>
>
> tcase_req.tcase_req_id is added
tcase.case_id=tcase_req.case_id :note
> that
> this is not part of the inner join in the from clause.
it does not depend
> on
> the rest of the inner join.
>
> the reaon for this is that i need to get
> WHERE tcase_req.case_req_typ_cd = cwc and
tcase_req.case_req_typ_cd =
> cwnc
>
> here is the original question
>
> Hello ,
> I need help again on the inner join/and conditions in
the where clause
>
> I have these 2 tables tcase and tcase_req where there
common field Is the
> case_id.
> tcase is the parent table and the tcase_req is the child
table.
>
> (1)I wanted to add this to the from clause using the
inner join table .
> what
> do I do and where do I put it
>
> (2)I then need to put a condition in the where clause to
replace
> WHERE TCASE.CASE_NBR Like '%HPOZ%'
> AND TCASE.CASE_NBR = 'DIR-2004-4269-HPOZ-CCMP'
> by
> WHERE TCASE.CASE_NBR Like '%CWC%' or TCASE.CASE _NBR
Like '%CWNC%'
> AND TCASE.CASE_NBR = 'DIR-2004-4269-CWC'
> Or TCASE.CASE_NBR = 'DIR-2004-4269-CWNC'
>
> is this efficient??
>
>
>
> thanks
> --------------------
>
> SELECT TLA_PROP.PIN,
> TLA_PROP.ASSR_PRCL_NBR,
> TCASE.CASE_NBR,
> TLA_PROP.STR_NBR,
> TLA_PROP.STR_NBR_RNG_END,
> TLA_PROP.STR_FRAC_NBR,
> Tref_plan_area.plan_area_desc,
> TLA_PROP.STR_FRAC_NBR_RNG_END,
> TLA_PROP.STR_DIR_CD,
> TLA_PROP.STR_NM,
> TLA_PROP.STR_SFX_CD,
> TLA_PROP.STR_SFX_DIR_CD,
> TLA_PROP.STR_UNIT_TYP_CD,
> TLA_PROP.UNIT_NBR,
> TLA_PROP.UNIT_NBR_RNG_END,
> TLA_PROP.ZIP_CD,
> TLA_PROP.ZIP_CD_SFX,
> TLA_PROP.CNCL_DIST_NBR,
> TLA_PROP.PLAN_AREA_NBR,
> TLA_PROP.ZONE_REG_CD,
> TAPLC.PROJ_DESC_TXT,
> TCASE.CASE_ID,
> TCASE.CASE_NBR,
> taplc.aplc_id,
> tcase_req.case_req_typ_cd
> FROM TLA_PROP INNER JOIN tref_plan_area ON
tla_prop.plan_area_nbr =
> tref_plan_area.plan_area_NBR INNER JOIN TLOC ON
TLA_PROP.PROP_ID =
> TLOC.LOC_ID
> INNER JOIN TAPLC ON TLOC.APLC_ID = TAPLC.APLC_ID INNER
JOIN TCASE ON
> TAPLC.APLC_ID = TCASE.APLC_ID
> WHERE TCASE.CASE_NBR Like '%CWC%'and
tcase.case_id=tcase_req.case_id
>
>
>
>
> (3)To a tcase_req
> Suffix_id are equal to = cwc and cwnc ( in the tcase_req
table)(Suffix_id
> is
> the field that cintains the suffix cwc and cwnc for the
tcase_req)
>
> also,
> this is the original query and it works fine
> SELECT TLA_PROP.PIN,
> TLA_PROP.ASSR_PRCL_NBR,
> TCASE.CASE_NBR,
> TLA_PROP.STR_NBR,
> TLA_PROP.STR_NBR_RNG_END,
> TLA_PROP.STR_FRAC_NBR,
> Tref_plan_area.plan_area_desc,
> TLA_PROP.STR_FRAC_NBR_RNG_END,
> TLA_PROP.STR_DIR_CD,
> TLA_PROP.STR_NM,
> TLA_PROP.STR_SFX_CD,
> TLA_PROP.STR_SFX_DIR_CD,
> TLA_PROP.STR_UNIT_TYP_CD,
> TLA_PROP.UNIT_NBR,
> TLA_PROP.UNIT_NBR_RNG_END,
> TLA_PROP.ZIP_CD,
> TLA_PROP.ZIP_CD_SFX,
> TLA_PROP.CNCL_DIST_NBR,
> TLA_PROP.PLAN_AREA_NBR,
> TLA_PROP.ZONE_REG_CD,
> TAPLC.PROJ_DESC_TXT,
> TCASE.CASE_ID,
> TCASE.CASE_NBR,
> taplc.aplc_id
> FROM TLA_PROP INNER JOIN tref_plan_area ON
tla_prop.plan_area_nbr =
> tref_plan_area.plan_area_NBR INNER JOIN TLOC ON
TLA_PROP.PROP_ID =
> TLOC.LOC_ID
> INNER JOIN TAPLC ON TLOC.APLC_ID = TAPLC.APLC_ID INNER
JOIN TCASE ON
> TAPLC.APLC_ID = TCASE.APLC_ID
> WHERE (TCASE.CASE_NBR Like '%CWC%' or TCASE.CASE_NBR
Like '%CWNC%')
>
Similar Messages
-
Join/from/where/ combine queries2
Hello ,
I need help again on the inner join/and consitions in the
where clause
I have these 2 tables tcase and tcase_req where there common
field Is the case_id.
tcase is the parent table and the tcase_req is the child
table.
(1)I wanted to add this to the from clause using the inner
join table . what do I do and where do I put it
(2)I then need to put a condition in the where clause to
replace
WHERE TCASE.CASE_NBR Like '%HPOZ%'
AND TCASE.CASE_NBR = 'DIR-2004-4269-HPOZ-CCMP'
by
WHERE TCASE.CASE_NBR Like '%CWC%' or TCASE.CASE _NBR Like
'%CWNC%'
AND TCASE.CASE_NBR = 'DIR-2004-4269-CWC'
Or TCASE.CASE_NBR = 'DIR-2004-4269-CWNC'
is this efficient??
(3)To a tcase_req
Suffix_id are equal to = cwc and cwnc ( in the tcase_req
table)(Suffix_id is the field that cintains the suffix cwc and cwnc
for the tcase_req)
Where do I add all this to?
Here is the current query,below: THANKS
SELECT TLA_PROP.PIN,
TLA_PROP.ASSR_PRCL_NBR,
TCASE.CASE_NBR,
TLA_PROP.STR_NBR,
TLA_PROP.STR_NBR_RNG_END,
TLA_PROP.STR_FRAC_NBR,
Tref_plan_area.plan_area_desc
TLA_PROP.STR_FRAC_NBR_RNG_END,
TLA_PROP.STR_DIR_CD,
TLA_PROP.STR_NM,
TLA_PROP.STR_SFX_CD,
TLA_PROP.STR_SFX_DIR_CD,
TLA_PROP.STR_UNIT_TYP_CD,
TLA_PROP.UNIT_NBR,
TLA_PROP.UNIT_NBR_RNG_END,
TLA_PROP.ZIP_CD,
TLA_PROP.ZIP_CD_SFX,
TLA_PROP.CNCL_DIST_NBR,
TLA_PROP.PLAN_AREA_NBR,
TLA_PROP.ZONE_REG_CD,
TAPLC.PROJ_DESC_TXT,
TCASE.CASE_ID,
TCASE.CASE_NBR,
taplc.aplc_id
FROM TLA_PROP
INNER JOIN tref_plan_area ON tla_prop.plan_area_nbr =
tref_plan_area.plan_area_NBR
INNER JOIN TLOC ON TLA_PROP.PROP_ID = TLOC.LOC_ID
INNER JOIN TAPLC ON TLOC.APLC_ID = TAPLC.APLC_ID
INNER JOIN TCASE ON TAPLC.APLC_ID = TCASE.APLC_ID
WHERE TCASE.CASE_NBR Like '%HPOZ%'
AND TCASE.CASE_NBR = 'DIR-2004-4269-HPOZ-CCMP'If you are going to use OR conditions with AND conditions you
need to use parenthesis:
WHERE (TCASE.CASE_NBR Like '%CWC%' or TCASE.CASE _NBR Like
'%CWNC%')
AND (TCASE.CASE_NBR = 'DIR-2004-4269-CWC'
Or TCASE.CASE_NBR = 'DIR-2004-4269-CWNC')
But if you are really hardcoding the case number values you
are wasting time with a LIKE comparison so you could just have:
WHERE TCASE.CASE_NBR = 'DIR-2004-4269-CWC'
Or TCASE.CASE_NBR = 'DIR-2004-4269-CWNC'
You might get a more efficient response if not atleast more
readable code with:
WHERE TCASE.CASE_NBR in
('DIR-2004-4269-CWC','DIR-2004-4269-CWNC')
thanks
hmm
there is an error
Error Executing Database Query.
ORA-00911: invalid character
The error occurred in D:.cfm: line 38
Called from line 38
36 : taplc.aplc_id
37 : FROM TLA_PROP INNER JOIN tref_plan_area ON
tla_prop.plan_area_nbr = tref_plan_area.plan_area_NBR INNER JOIN
TLOC ON TLA_PROP.PROP_ID = TLOC.LOC_ID INNER JOIN TAPLC ON
TLOC.APLC_ID = TAPLC.APLC_ID INNER JOIN TCASE ON TAPLC.APLC_ID =
TCASE.APLC_ID
38 : WHERE TCASE.CASE_NBR Like '%CWC%' or TCASE.CASE _NBR
Like '%CWNC%')and TCASE.CASE_NBR = '#form.caseNbr#'
39 : </cfquery>
40 :
also,
what about the inner join question and question (3) below:
SQL SELECT TLA_PROP.PIN, TLA_PROP.ASSR_PRCL_NBR,
TCASE.CASE_NBR, TLA_PROP.STR_NBR, TLA_PROP.STR_NBR_RNG_END,
TLA_PROP.STR_FRAC_NBR, Tref_plan_area.plan_area_desc,
TLA_PROP.STR_FRAC_NBR_RNG_END, TLA_PROP.STR_DIR_CD,
TLA_PROP.STR_NM, TLA_PROP.STR_SFX_CD, TLA_PROP.STR_SFX_DIR_CD,
TLA_PROP.STR_UNIT_TYP_CD, TLA_PROP.UNIT_NBR,
TLA_PROP.UNIT_NBR_RNG_END, TLA_PROP.ZIP_CD, TLA_PROP.ZIP_CD_SFX,
TLA_PROP.CNCL_DIST_NBR, TLA_PROP.PLAN_AREA_NBR,
TLA_PROP.ZONE_REG_CD, TAPLC.PROJ_DESC_TXT, TCASE.CASE_ID,
TCASE.CASE_NBR, taplc.aplc_id FROM TLA_PROP INNER JOIN
tref_plan_area ON tla_prop.plan_area_nbr =
tref_plan_area.plan_area_NBR INNER JOIN TLOC ON TLA_PROP.PROP_ID =
TLOC.LOC_ID INNER JOIN TAPLC ON TLOC.APLC_ID = TAPLC.APLC_ID INNER
JOIN TCASE ON TAPLC.APLC_ID = TCASE.APLC_ID WHERE TCASE.CASE_NBR
Like '%CWC%' or TCASE.CASE _NBR Like '%CWNC%')and TCASE.CASE_NBR =
'DIR-2004-4242-CWNC'
DATASOURCE
VENDORERRORCODE 911
SQLSTATE 42000
Resources
Hello ,
I need help again on the inner join/and consitions in the
where clause
I have these 2 tables tcase and tcase_req where there common
field Is the case_id.
tcase is the parent table and the tcase_req is the child
table.
(1)I wanted to add this to the from clause using the inner
join table . what do I do and where do I put it
(2)I then need to put a condition in the where clause to
replace
WHERE TCASE.CASE_NBR Like '%HPOZ%'
AND TCASE.CASE_NBR = 'DIR-2004-4269-HPOZ-CCMP'
by
WHERE TCASE.CASE_NBR Like '%CWC%' or TCASE.CASE _NBR Like
'%CWNC%'
AND TCASE.CASE_NBR = 'DIR-2004-4269-CWC'
Or TCASE.CASE_NBR = 'DIR-2004-4269-CWNC'
is this efficient??
(3)To a tcase_req
Suffix_id are equal to = cwc and cwnc ( in the tcase_req
table)(Suffix_id is the field that cintains the suffix cwc and cwnc
for the tcase_req)
Where do I add all this to?
Here is the current query,below: THANKS -
How to combine two user prompts into 1 single prompt from two Webi Queries
Hi All,
I developed a single webi report from two different queries on top of 2 BW OLAP universe .
Here I have one user input prompt for each query so I want to combine them into one single user input promt which should pass the user input value to both the Webi queries feeding data to the single webi report.
I found that the webi doc has auto checked merge dimensions enabled but it is not providing combined resluts from both the queries .
Any inputs are greatlt appreciated.
ThanksStratos
Firstly ,I appreciate your responses for my two questions.
Both the prompts I am using are from the masterdata and they are similar.data types.I think the transactional data is not available in BW for one of the prompt ,hence I am not getting consistent data.
Anyway will do further investigation in finding similarities and let you know.
Thanks a lot -
CONNECT BY with CROSS JOIN and WHERE not executing as described in doc
Hello all,
please see these two statements. They are the same, but the 1st uses t1 INNER JOIN t2 while the snd uses a CROSS JOIN with WHERE.
The 2nd statement shows one row more than the first, but the CROSS JOIN with WHERE is the same as the INNER JOIN.
The result would be OK if Oracle did:
JOIN -> CONNECT BY PRIOR -> WHERE
But according to the docs it does:
JOIN (and WHEREs for JOINS) -> CONNECT BY PRIOR -> Rest of WHERE
See http://docs.oracle.com/cd/E11882_01/server.112/e26088/queries003.htm#SQLRF52332 for details. There it says:
Oracle processes hierarchical queries as follows:
A join, if present, is evaluated first, whether the join is specified in the FROM clause or with WHERE clause predicates.
The CONNECT BY condition is evaluated.
Any remaining WHERE clause predicates are evaluated.
+.....+
Is this a bug? I'd say yes, because it differs from the docs and it also is not what people are used to ("a,b WHERE" is the same as "a INNER JOIN b").
Thanks,
Blama
--Statement 1:
WITH t1
AS
(SELECT 1 a, 2 b FROM DUAL UNION ALL
SELECT 2 a, 3 b FROM DUAL UNION ALL
SELECT 3 a, 4 b FROM DUAL UNION ALL
SELECT 4 a, 5 b FROM DUAL UNION ALL
SELECT 5 a, 6 b FROM DUAL),
t2 AS
(SELECT 1 c FROM DUAL UNION ALL
SELECT 2 c FROM DUAL UNION ALL
SELECT 3 c FROM DUAL UNION ALL
SELECT 5 c FROM DUAL)
SELECT DISTINCT t1.a, t2.c, t1.b, level, SYS_CONNECT_BY_PATH(t1.a, '/') Path
FROM t1 INNER JOIN t2
ON t1.a = t2.c
CONNECT BY t1.a = PRIOR t1.b
START WITH t1.a = 1
ORDER BY
1,2,3;
--Result:
--1 1 2 1 /1
--2 2 3 2 /1/2
--3 3 4 3 /1/2/3
--Statement 2:
WITH t1
AS
(SELECT 1 a, 2 b FROM DUAL UNION ALL
SELECT 2 a, 3 b FROM DUAL UNION ALL
SELECT 3 a, 4 b FROM DUAL UNION ALL
SELECT 4 a, 5 b FROM DUAL UNION ALL
SELECT 5 a, 6 b FROM DUAL),
t2 AS
(SELECT 1 c FROM DUAL UNION ALL
SELECT 2 c FROM DUAL UNION ALL
SELECT 3 c FROM DUAL UNION ALL
SELECT 5 c FROM DUAL)
SELECT DISTINCT t1.a, t2.c, t1.b, level, SYS_CONNECT_BY_PATH(t1.a, '/') Path
FROM t1 CROSS JOIN t2
WHERE t1.a = t2.c
CONNECT BY t1.a = PRIOR t1.b
START WITH t1.a = 1
ORDER BY
1,2,3;
--Result:
--1 1 2 1 /1
--2 2 3 2 /1/2
--3 3 4 3 /1/2/3
--5 5 6 5 /1/2/3/4/5My details:
Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production
PL/SQL Release 11.2.0.2.0 - Production
CORE 11.2.0.2.0 Production
TNS for Solaris: Version 11.2.0.2.0 - Production
NLSRTL Version 11.2.0.2.0 - Productionblama wrote:
Hello Paul,
that means that "a,b" isn't the same as "a CROSS JOIN b".
I don't think that that is really the case.
Do you have docs on this one?No explicit docs just (my) logic - having said that, I suppose it is implied that if you are doing ANSI style joins, it's not the where clauses that
are specifying the join.
If you do t1,t2 where t1.a=t2.a then Oracle figures out the kind of join from the (relevant) where clauses and treats the other where clauses after the CONNECT BY.
If you do t1 cross join t2 where t1.a=t2.a then you are saying the join is completely specified by the CROSS JOIN - i.e it's Cartesian. Oracle doesn't look at the where clauses for this. Therefore
all where clauses are treated as 'other' and are evaluated after the CONNECT BY.
So, in my mind it's 10g that has the bug. -
OUTER JOIN on tw inner queries
Could you please help me with this.
There is inner queryA which finds the userID, count(complete) from various tables.
There is another inner queryB which finds UserID, count(Assign) from another set of tables.
Also there is Master tableC with UserID, UserName.
I need to find for each UserID, the UserName, Count(Complete), Count(Assign). There are some UserIDs which may exist in innerQueryA's results but not in innerQueryB's results and viceversa. But I need to be able to pull those records as well in final result.
Hence I tried to perform Outer Join between these inner queries and tableC, but PL/SQL compiler gives an error.
Could you please help me find resolution for this. Also we do not have enough privileges to create any views on the database where the final query should be run.
Thanks for your help.Hi,
Welcome to the forum!
user8656926 wrote:
Could you please help me with this.
There is inner queryA which finds the userID, count(complete) from various tables.
There is another inner queryB which finds UserID, count(Assign) from another set of tables.
Also there is Master tableC with UserID, UserName.
I need to find for each UserID, the UserName, Count(Complete), Count(Assign). There are some UserIDs which may exist in innerQueryA's results but not in innerQueryB's results and viceversa. But I need to be able to pull those records as well in final result.
Hence I tried to perform Outer Join between these inner queries and tableC, but PL/SQL compiler gives an error.You're on the right track: this is exactly the situation that calls for an outer join. Both A and B should be outer-joined to C.
It would be a lot easier to say what you were doing wrong if you posted your code and the error message.
Could you please help me find resolution for this. Also we do not have enough privileges to create any views on the database where the final query should be run.That's fine: you shouldn't need to create views or anything like that. -
Outer Join with Where Clause in LTS
HI all,
I have a requirement like this in ANSI SQL:
select p1.product_id, p1.product_name, p2.product_group
from product p1 left outer join product_group p2 on p1.product_id = p2.product_id
and p2.product_group = 'NEW'
In Regular SQL:
select p1.product_id, p1.product_name, p2.product_group
from product p1, product_group p2
WHERE p1.product_id *= p2.product_id and p2.product_group = 'NEW'
In OBIEE, I am using a left outer join between these two in Logical table Source, and also, Gave
p2.product_group = 'NEW' in WHERE clause of LTS.
This doesn't seem to solve purpose.
Do you have any idea how to convert WHERE clause in physical query that OBIEE is generating to something like
product p1 left outer join product_group p2 on p1.product_id = p2.product_id AND p2.product_group = 'NEW'
I am using Version 10.1.3.4.1
Creating an Opaque view would be my last option though.Hello
I have read your post and the responses as well. and I understand that you have issues with the Outer Join with where Clause in LTS.
Try this solution which worked for me (using your example ) -
1. In the Physical Layer created a Complex join between PRODUCT and PRODUCT_GROUP tables and use this join relationship :
PRODUCT.PROD_ID = PRODUCT_GROUP.PROD_ID AND PRODUCT_GROUP.GROUP_NAME = 'MECHANICAL'
2. In the General Tab of PRODUCT table LTS add PRODUCT_GROUP table and select Join Type as Left Outer Join.
3. Check Consistency and make sure there are no errors .
when you run a request you should see the following query generated -
select distinct T26908.PROD_ID as c1,
T26908.PROD_NAME as c2,
T26912.GROUP_NAME as c3
from
PRODUCT T26908 left outer join PRODUCT_GROUP T26912 On T26908.PROD_ID = T26912.PROD_ID and T26912.GROUP_NAME = 'MECHANICAL'
order by c1, c2, c3
Hope this works for you. If it does please mark this response as 'Correct' .
Good Luck. -
What is joins?where we use it. is it DD concept? abap
hi abapers,
what is joins?where we use it. is it DD concept?
regards,
anjanhi srinivas.
chk this simple example.
u will get good idea.
table emp
empno name
a sasi
b xxx
c yyy
table sal
empno salary
a 1000
b 2000
Inner join
select eempno ename
s~sal
into table int_table
from emp as e
inner join sal
on
eempno = sempno.
if you made inner join between table a and b by emp no
the selection retrives only if the condition satisfy the output will be
a sasi 1000
b xxx 2000
Outer join
select eempno ename
s~sal into table int_table
from emp as e
LEFT OUTER JOIN sal
on
eempno = sempno.
if you made outer join (left /right ) the left table kept as it is the
if the condition satisfy the right table entries will fetch else leave it blank
the output will be
a sasi a 1000
b xxx b 2000
c yyy
rgds
anver
if helped mark points -
Hi
I have a query regarding combined queries. I am using BO XI R2 Deski. When i create combined queries, i have observed that BO is processing theses queries in the order from right to left i.e it is executing the last two queries first and then then the next right most and so on...
For example if i want to calculate (A Union B) minus (C Intersection D). I am unable to frame this query. When i see the SQL the order is different. Please advise how can i set this preference like first calculate ( A Union B) and ( C Intersection D) and then subtract bothe the result sets.
Thanks,
RaveendraHi Raveendra,
I Tried and able to perform operation Separately like (A union B) and (C Intersection D) and also succeed to put the result side by side but not able to succeed in finding the Minus of the results. Because as you said DESKI perform operations from left to right for each combined query.
I performed union and Intersection operations separately by using 2 data providers.
I used demo universe eFashion for union and intersection.
The Steps followed are as follows:
1. Select eFashion Take objects Year, Store Name, Sales revenue
2. Click Combine Queries and Take same objects because Union operation requires both queries Must have have same objects.
3. Union these 2 Queries Run The Report you will get the Union of 2 Queries. (A Union B)
4.Select New Data Provider (Data New Data Provider)
5. Select Universe you want Take objects in Query C, I Took Same objects with different condition like (Year Inlist(2002,2003))
6. Query D with Condition (Year Equalto(2002)) you will get Results (Query C intersection D). Results that contain only Year Equal to 2002.
Now you have objects from 2 data providers together, Drag and Drop Objects from 2 data providers and put them at different places on Report now you can compare the results.
Here we canu2019t Minus the results because when you click Edit Data Provider, DESKI will Prompt you to select the data provider to Edit and hence we can perform edit operation on One data provider one at a time and not together.
I Hope this is useful.
Thanksu2026
Pratik -
Hi all,,I am new learner to ABAP. I want to know from where we need to start ABAP.Becaz as of now I am not following any order.Can anyone tell me the order to follow..
thanks in advanceHi,
http://cma.zdnet.com/book/abap/index.htm
Here are the few links which covers topic by topic.
http://help.sap.com/saphelp_40b/helpdata/en/4f/991f82446d11d189700000e8322d00/applet.htm SAP Online Help For Dictionary.
http://www.sappoint.com/abap.html
for SAPscripts
ABAP objects and control technology
IDOC
SapScript
Performance tuning
BAPI Programming
Visual Basic Integration - Using the DCOM Connector and BAPI OCX (Only available in Danish)
JAVA and the SAP java connector
http://www.sts.tu-harburg.de/teaching/sap_r3/ABAP4/abapindx.htm
for keywords
very useful link for all
http://www.geocities.com/victorav15/sapr3/abapfun.html
http://www.sapgenie.com/abap/index.htm
http://www.sap-img.com/abap.htm
http://www.sapdevelopment.co.uk/tips/tipshome.htm
http://help.sap.com/printdocu/core/Print46c/en/Data/Index_en.htm
http://sap.ittoolbox.com/nav/t.asp?t=322&p=322&h1=322
http://sap.ittoolbox.com/nav/t.asp?t=448&p=448&h1=448
http://www.thespot4sap.com/
http://www.kabai.com/abaps/q.htm
http://www.geocities.com/mpioud/Abap_programs.html
http://www.sapgenie.com/abap/tips_and_tricks.htm
http://www.sapassist.com/code/d.asp?whichpage=1&pagesize=10&i=10&a=c&o=&t=&q=&qt=
For FAQ
http://www.sap-img.com/abap/more-than-100-abap-interview-faqs.htm
http://www.sapgenie.com/faq/abap.htm
Modulepool
http://sap.mis.cmich.edu/sap-abap/abap09/sld007.htm
BAPI-step by step
http://www.sapgenie.com/abap/bapi/example.htm
Weblog for receive email and processing it through ABAP
/people/thomas.jung3/blog/2004/09/09/receiving-e-mail-and-processing-it-with-abap--version-610-and-higher
BADI
http://www.sapdevelopment.co.uk/enhance/enhance_badi.htm
For Logical database
http://help.sap.com/saphelp_46c/helpdata/en/9f/db9bed35c111d1829f0000e829fbfe/frameset.htm
http://help.sap.com/saphelp_nw04/helpdata/en/6a/8b14e2340d11d5b3ba0050dae02d7c/content.htm
very useful
http://help.sap.com/saphelp_46c/helpdata/EN/35/2cd77bd7705394e10000009b387c12/frameset.htm
Useful link to websites
http://www.hernangn.com.ar/sap.htm
Useful for background
http://www.sappoint.com/basis/bckprsng.pdf
http://help.sap.com/saphelp_nw04/helpdata/en/6f/08703713bf277ee10000009b38f8cf/frameset.htm
http://publib.boulder.ibm.com/infocenter/wbihelp/index.jsp?topic=/com.ibm.wbix_adapters.doc/doc/mysap4/sap4x41.htm
Table control in BDC
http://www.sap-img.com/abap/bdc-example-using-table-control-in-bdc.htm
For posting weblog,
/people/sap.user72/blog/2005/06/28/sdn-weblogs-making-it-easier
Dynamic Internal table -weblog in sdn
/people/subramanian.venkateswaran2/blog/2004/11/19/dynamic-internal-table
Smartforms
http://www.sap-basis-abap.com/sapsf001.htm
http://www.sap-press.com/downloads/h955_preview.pdf
http://www.ossincorp.com/Black_Box/Black_Box_2.htm
http://www.sap-img.com/smartforms/sap-smart-forms.htm
http://www.sap-img.com/smartforms/smartform-tutorial.htm
http://www.sapgenie.com/abap/smartforms.htm
http://www.allsaplinks.com/smartform_example.html
How to trace smartform
http://help.sap.com/saphelp_47x200/helpdata/en/49/c3d8a4a05b11d5b6ef006094192fe3/frameset.htm
Workflow
http://help.sap.com/saphelp_46c/helpdata/en/c5/e4b7eb453d11d189430000e829fbbd/frameset.htm
http://www.sap-img.com/workflow/sap-workflow.htm
http://help.sap.com/saphelp_47x200/helpdata/en/a5/172437130e0d09e10000009b38f839/frameset.htm
For examples on WorkFlow...check the below link..
http://help.sap.com/saphelp_47x200/helpdata/en/3d/6a9b3c874da309e10000000a114027/frameset.htm
http://help.sap.com/printdocu/core/Print46c/en/data/pdf/PSWFL/PSWFL.pdf
http://help.sap.com/saphelp_47x200/helpdata/en/4a/dac507002f11d295340000e82dec10/frameset.htm
http://www.workflowing.com/id18.htm
http://www.e-workflow.org/
http://web.mit.edu/sapr3/dev/newdevstand.html
ALV
http://www.geocities.com/mpioud/Abap_programs.html
http://72.14.203.104/search?q=cache:NjFXTBr5lX8J:www.sap-img.com/abap/an-interactive-alv-report.htmALVInteractivereportsABAP&hl=en&gl=in&ct=clnk&cd=5
Mail
http://www.sapdevelopment.co.uk/reporting/email/attach_xls.htm(for changing sender address)
http://www.sap-img.com/fu016.htm
http://www.geocities.com/mpioud/Z_EMAIL_ABAP_REPORT.html
http://www.thespot4sap.com/Articles/SAP_Mail_SO_Object_Send.asp
http://www.sapdevelopment.co.uk/reporting/email/attach_xls.htm
Sending mail in background or spool mail
http://www.sap-basis-abap.com/sapac018.htm
BOM Explosion
/people/prakash.singh4/blog/2005/05/15/explode-boms-in-enterprise-portal-using-htmlb-tree--part-1-abap
BOM
http://help.sap.com/saphelp_erp2005/helpdata/en/ea/e9b7234c7211d189520000e829fbbd/frameset.htm
http://help.sap.com/saphelp_erp2005/helpdata/en/d1/2e4114a61711d2b423006094b9d648/frameset.htm
http://www.sap-img.com/sap-sd/sales-bom-implementation.htm
http://www.sap-basis-abap.com/sappp007.htm
OLE
http://www.sapgenie.com/abap/ole.htm
http://help.sap.com/saphelp_46c/helpdata/en/59/ae3f2e488f11d189490000e829fbbd/frameset.htm
ALVGRID with refresh
http://www.geocities.com/mpioud/Z_DEMO_ALV_REFRESH_BUTTON.html
For language setting and decimal separator
/people/horst.keller/blog/2004/11/16/abap-geek-7-150-babylonian-confusion
Oracle queries
http://sqlzoo.net/
To format SQL
http://www.sqlinform.com/
SCOT settings
http://www.sap-img.com/basis/basis-faq.htm
Status Icon [ALV,Table Control,Tab Strip]
http://www.sapdesignguild.org/resources/MiniSG-old/from_develop/norm_status_icons.htm#positioning_4
ALV Group Heading
http://www.sap-img.com/fu037.htm
For multiMedia
/people/thomas.jung3/blog/2005/05/11/using-classic-activex-controls-in-the-abap-control-framework
Uploading LOGO in SAP
http://www.sap-img.com/ts001.htm
LSMW
http://www.sap-img.com/sap-data-migration.htm
http://www.sapgenie.com/saptech/lsmw.htm
http://www.allsaplinks.com/lsmw.html
http://sapabap.iespana.es/sapabap/manuales/pdf/lsmw.pdf
http://www.sap.info/public/INT/int/glossary/int/glossaryletter/Word-17643ed1d6d658821_glossary/L#Word-17643ed1d6d658821_glossary
http://www.scmexpertonline.com/downloads/SCM_LSMW_StepsOnWeb.doc
OOPS ALV
OOPS - Events.
Editable ALV
Tree
TabStrip
Multigrid
Check this for basic concepts of OOPS
https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/webas/abap/abap%20code%20samples/abap%20objects/abap%20code%20sample%20to%20learn%20basic%20concept%20of%20object-oriented%20programming.doc
https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/webas/abap/abap%20code%20samples/alv%20grid/abap%20code%20sample%20to%20display%20data%20in%20alv%20grid%20using%20object%20oriented%20programming.doc
Tabstrip
https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/webas/abap/abap%20code%20samples/alv%20grid/abap%20code%20sample%20for%20tab%20strip%20in%20alv.pdf
Editable ALV
https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/webas/abap/abap%20code%20samples/alv%20grid/abap%20code%20sample%20to%20edit%20alv%20grid.doc
Tree
http://www.sapdevelopment.co.uk/reporting/alv/alvtree/alvtree_usrint.htm
General Tutorial for OOPS
https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/webas/abap/an%20easy%20reference%20for%20alv%20grid%20control.pdf
Function Module
http://www.geocities.com/victorav15/sapr3/abapfun.html
My Links
Smartforms
https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/uuid/ccab6730-0501-0010-ee84-de050a6cc287(subroutine)
https://sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/uuid/8fd773b3-0301-0010-eabe-82149bcc292e
https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/uuid/3c5d9ae3-0501-0010-0090-bdfb2d458985
Table Control
https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/webas/abap/abap-code-samples/table%20control%20in%20abap.pdf
HRABAP
http://help.sap.com/printdocu/core/Print46c/en/data/pdf/PAPA/PAPA.pdf
http://help.sap.com/printdocu/core/Print46c/en/data/pdf/PAPD/PAPD.pdf
http://help.sap.com/printdocu/core/Print46c/en/data/pdf/PYINT/PYINT_BASICS.pdf
http://www.atomhr.com/training/Technical_Topics_in_HR.htm
http://www.planetsap.com/hr_abap_main_page.htm
you can see some Standard Program examples in this one..
http://www.sapdevelopment.co.uk/programs/programshr.htm
http://searchsap.techtarget.com/originalContent/0,289142,sid21_gci1030179,00.html?Offer=SAlgwn12604#Certification
These are the FAQ's that might helps you
http://www.sap-img.com/human/hr-faq.htm
http://www.sapgenie.com/faq/hr.htm
RFC
http://johnv.sapgenie.com/docs/RFC.pdf
http://zerone.samcheok.ac.kr/Asp_pr/Language/.%5Cuploadfile%5CJCo%20Tutorial-1.pdf
http://www.sapgenie.com/sapgenie/docs/SAP%20Connectors.doc
BADI
http://esnips.com/doc/10016c34-55a7-4b13-8f5f-bf720422d265/BADIs.pdf
http://esnips.com/doc/e06e4171-29df-462f-b857-54fac19a9d8e/ppt-on-badis.ppt
http://esnips.com/doc/43a58f51-5d92-4213-913a-de05e9faac0d/Business-Addin.doc
http://esnips.com/doc/1e10392e-64d8-4181-b2a5-5f04d8f87839/badi.doc
http://esnips.com/doc/365d4c4d-9fcb-4189-85fd-866b7bf25257/customer-exits--badi.zip
http://esnips.com/doc/3b7bbc09-c095-45a0-9e89-91f2f86ee8e9/BADI-Introduction.ppt
Regards,
Laxmi.
Edited by: Laxmi on Mar 14, 2008 6:24 PM -
Can anyone tell me from where origin and destination countries be picked
Can anyone tell me from where origin and destination countries be picked for a vendor a having scheduling agreement
Please consider the following points.
1. I need the table names
2. Table having combination plant and vendor
Please help me on thisHi
Originating country is vendor country , found in LFA1 table.
Destination country is the country of plant if the delivery address has not been changed manually or storage location address if storage location address is maintained.
For plant country you can get it from T001W & for storage location you will get the address number from TWLAD table for plant & storage location combination & then you can get the country from table ADRC using this address number.
Regards
Prasad -
Absolute dynamic select query with dynamic join and where
Has anyone ever tried creating an absolutely dynamic SELECT query with dynamic Join and Where conditions.
I have a requirement of creating such a query in an Utility Class, and i have written the code. But its throwing my sysntax errors.
Please let me know where am I going wrong OR is it really possible to create such a dynamic Query??
SELECT (FIELDS) INTO TABLE IT_TABLES
FROM ( (ME->TABLE1) inner join ( me->table2 )
on ( on_condition ) )
WHERE (me->where_fields).
Ags.It worked for me in a following way:
select * into corresponding fields of table <result_table>
from (join_string)
where (l_where).
Where the contents of join_string were dynamically build using concatenation. So it will be something like
concatenate ME->TABLE1 'as a INNER JOIN' me->table2 'as b ON (' into join_string separated by space.
<...>
add here matching/reference colums, something like
concatenate 'a~' me->TABLE1_JOIN_COL into temp1.
concatenate 'b~' me->TABLE2_JOIN_COL into temp2.
concatenate join_string temp1 '=' temp2 into join_string separated by space.
<...>
concatenate join_string ')' into join_string separated by space.
And then use similar approach for l_where variable. -
Query to get the difference between 2 totals from 2 different queries
I wanted to know if it is possible to get the difference between 2 totals from 2 different queries. I would explain with an example:
1st query - Select sum(homepass) from table 1
2nd query – select sum(homepass) from table2
Is it possible to display the difference like-
Select sum(homepass) from table 1 - sum(homepass) from table2
I know the above query would gives syntax error but is there a better way or a trick to get the above task accomplished from a single query.
I hope, my question is clear.
Please revert with the reply to my query.
Regardstomernitin wrote:
Try this one also:
WITH adtn1
AS
SELECT 110 val1 FROM dual UNION ALL
SELECT 100 FROM dual UNION ALL
SELECT 90 FROM dual UNION ALL
SELECT 10 FROM dual
adtn2
AS
SELECT 10 val2 FROM dual UNION ALL
SELECT 20 FROM dual UNION ALL
SELECT 30 FROM dual UNION ALL
SELECT 100 FROM dual
SELECT(Sum(a1.val1)-Sum(a2.val2)) Diff FROM adtn1 a1,adtn2 a2;
let me know if you still have any doubt.
Um.... I don't think so. Not with the cartesian join between a1 and 2. -
Re : How to retrieve Combined Queries (RE Bean SDK) -XIR2 SP2
Hello all,
Hope all is well. I am kinda stuck here ...trying to retrieve Combined Queries from WebI Document. I just have 1 report , 1 DP, 1 combined query(union) with 2 nodes coming off of universe ( __NO__ Custom SQL).
Could someone give me sample code as how to retrieve this...I was able get DP and then Query container...then kinda got lost.How do I retrieve individual query and then get more information of an individual query like DataSourceObject.
QueryContainer qCont = dataProv.getCombinedQueries();
int operator = qCont ();
// getQueryContainerOperator
// then how doi I proceed further to retrieve individual query.
Thanks in advance,
Sam.I don't have any code for retrieving the combined queries, however I have some code for retrieving the SQL from a dataprovider- it might give you an idea of how to get the combined query
oInfoObject = (IInfoObject) oInfoObjects.get(0);
// Initialize the Report Engine
ReportEngines oReportEngines = (ReportEngines) oEnterpriseSession.getService("ReportEngines");
ReportEngine oReportEngine = (ReportEngine) oReportEngines.getService(ReportEngines.ReportEngineType.WI_REPORT_ENGINE);
// Openning the document
DocumentInstance oDocumentInstance = oReportEngine.openDocument(oInfoObject.getID());
DataProvider oDataProvider = null;
SQLDataProvider oSQLDataProvider = null;
SQLContainer oSQLContainer_root = null;
SQLNode oSQLNode = null;
SQLSelectStatement oSQLSelectStatement = null;
String sqlStatement = null;
out.print("<TABLE BORDER=1>");
for (int i=0; i<oDocumentInstance.getDataProviders().getCount(); i++) {
oDataProvider = oDocumentInstance.getDataProviders().getItem(i);
out.print("<TR><TD COLSPAN=2 BGCOLOR=KHAKI>Data Provider Name: " + oDataProvider.getName() + "</TD></TR>");
oSQLDataProvider = (SQLDataProvider) oDataProvider;
oSQLContainer_root = oSQLDataProvider.getSQLContainer();
if (oSQLContainer_root != null) {
for (int j=0; j<oSQLContainer_root.getChildCount(); j++) {
oSQLNode = (SQLNode) oSQLContainer_root.getChildAt(j);
oSQLSelectStatement = (SQLSelectStatement) oSQLNode;
sqlStatement = oSQLSelectStatement.getSQL();
out.print("<TR><TD>" + (j+1) + "</TD><TD>" + sqlStatement + "</TD></TR>");
out.print("</TABLE>");
oDocumentInstance.closeDocument();
Shawn -
From where does Purchase Order picking the Tracking number.
Hi Experts,
Can some one tell me, from where the Tracking number is picking in Purchase Order transaction.
Is there any specific settings to check.
I Have created one PO, In Item level I can see tracking number *******. could any one of you tell me where does the system pick the tracking number from?
Thank You.I Can not see the default value button anywhere.
I need to get the Tracking number in PO.
However when I am trying with different vendor with Pur. Org I am able to get the Tracking number in the PO but I am unable to get the Tracking number with other Vendor and Purch. org combination.
Is there any specific settings to exist the tracking number.
Thank You. -
Is it Possible to make a join from a single table
Hi all,
Is it Possible to make a join from a single table
Suppose HR_ALL_ORGANIZATION_UNITS table
can we make a join in the following way
HR_ALL_ORGANIZATION_UNITS.ORGANIZATION_ID =HR_ALL_ORGANIZATION_UNITS.BUSINESS_GROUP_ID
Thanks in advanceHi
Yes you can join,
Like below =- it is called self join -
Slect a.oersson_id,a.employee_numebr, b.full_name
form
hr_all_organization_units a,
hr_all_organization_units b
where
a.person_id = b.person_id and
sysdate between a.effective_start_date and a.effective_end_date and
sysdate between b.effective_start_date and b.effective_end_date
914618 wrote:
Hi all,
Is it Possible to make a join from a single table
Suppose HR_ALL_ORGANIZATION_UNITS table
can we make a join in the following way
HR_ALL_ORGANIZATION_UNITS.ORGANIZATION_ID =HR_ALL_ORGANIZATION_UNITS.BUSINESS_GROUP_ID
Thanks in advance
Maybe you are looking for
-
Connection Timeout error in AS2 communication
Hi Gurus I am sending an order file to our vendors via Seeburger AS2 adaptor but I am getting the following error: Unable to forward message to JCA adapter. Reason: Fatal exception: com.sap.aii.af.ra.cci.XIRecoverableException: SEEBURGER AS2: java.ne
-
can't change font in new version of imovie
-
First of all, what's a bootable backup? I have a WD 320GB Mybook (fire wire/usb) backup drive. WD said that their included software doesn't create a bootable drive. I asked them because I told it to back up everything and it did except for 168 files.
-
Windows 7 - what version works with CS4
I currently have a laptop with Vista home basic - I upgraded to CS4 last year and it doesn't work with home basic. Anyone have an idea what versions of windows 7 will work with CS4 before I order it? I haven't been able to use my software for almost
-
HT5918 Mac Pro (Late 2013) Dual monitors freeze on startup?
I've got 2 monitors, 1 HDMI and 1 MiniDisplayPort/DVI into Thunderbolt, and the computer can't start, it crashes during the boot process. The main screen freezes just as the login comes up, the MDP screen is scrambled, and the mouse cursor is a spinn