Dont want to use outer joins
Hi Guys,
I have some data in lookup tables and in the main tables the foreign keys are nullable. For this I have to use outer join query. But as it matters on performance because I am using 100's of tables like this and its making the query really slow. Is there any other way to get rid of outer join and get the same result??
Thanks in advance.
Ghulam Mustafa Butt
First, why "avoid outer joins at all costs"? If you need the functionality of an outer join, using an outer join is the best option.
Second, I don't see where 161992's code does anything other than an inner join in a slighly more convoluted form.
Justin
Distributed Database Consulting, Inc.
http://www.ddbcinc.com/askDDBC
Similar Messages
-
Dont want to use group by with sum function..
Hi all
I am using sum function but i dont want to use group by since my query give me following output which i dont want I want.
0------------22---------(null) Furniture
0----------- 3700------ (null) अनपेड बिल्स देणे
15800-----14202-----(null) Petty Cash
(null)------ (null)------ 9109 Furniture
(null)------ (null)------ 1789 Petty Cash
(null)-------(null)------ 0 Checking In-Transfer
I want like
0------------22---------9109 Furniture
0----------- 3700------ 0 अनपेड बिल्स देणे
15800-----14202-----1789 Petty Cash
what should be the problem how I can handle the query my query is
select null as totalcr, null as totaldr, (sum(acct.amtsourcecr)-sum(acct.amtsourcedr)) as opening , ev.name as accountname
from fact_acct acct right OUTER join c_elementvalue ev on acct.account_id= ev.c_elementvalue_id
where acct.dateacct < '01/04/2010'
and ev.cr_account_base=2
group by ev.name
UNION
select sum(acct.amtsourcecr) as totalcr, sum(acct.amtsourcedr) as totaldr, null as opening
*,ev.name as accountname*
from fact_acct acct right OUTER join c_elementvalue ev on acct.account_id= ev.c_elementvalue_id
where acct.datetrx BETWEEN '01/04/2010' and '01/04/2010'
group by ev.name
if I remove group by it shows me error .....not a single group by function ...
please help me out ,,,
thanking youThis is one way you can do it without a group by:
SQL> with t as
2 (
3 select 0 amt1, 22 amt2, null amt3, 'Furniture' tag from dual union all
4 select 15800,14202,null, 'Petty Cash' from dual union all
5 select null, null, 9109, 'Furniture' from dual union all
6 select null, null, 1789, 'Petty Cash' from dual
7 )
8 select tag, amt1, amt2, amt3
9 from
10 (
11 select sum(amt1) over (partition by tag) amt1
12 ,sum(amt2) over (partition by tag) amt2
13 ,sum(amt3) over (partition by tag) amt3
14 ,first_value(t.tag) over (partition by t.tag order by rownum) tag
15 ,row_number() over (partition by t.tag order by rownum) rn
16 from t
17 )
18 where rn = 1
19 /
TAG AMT1 AMT2 AMT3
Furniture 0 22 9109
Petty Cash 15800 14202 1789 -
i have changed the apple ID (email) but on my iphone , the icloud is stil asking me to log in whit the old email.And it is poping-up on every 10 seconds.I never used icloud, and i dont want to use it.I just dont know how to disable the icloud.
If you see that pop up you enabled icloud. Whether you want or do not want now to use it irrelevant until you actually disable activation lock.
In order to do that you have to change your apple id back to do that just long enough to sign in and back out. System will ask you to verify, don't.
Just sign in on the prompt you getting and then logout. Once done, change apple id to what you have now and verify. Then decide if you want to
use icloud (who does not want to be able to track their phone if lost or stolen). -
How to use outer join condition in my below query.
Hi All,
How to use outer join condition in my below query.
In the table APPS_JP.GEDIS_OFFER_HEADER goh I have more records
in the table APPS_JP.GEDIS_ORDER_BUILDS gob I have less number of records.
I want all the records from APPS_JP.GEDIS_OFFER_HEADER goh
including other conditions.
I have tried goh.OFFER_NO=gob.OFFER_NO(+) but same result.
[code]SELECT GOH.ORIG_SYSTEM,
gsp.USER_NAME,
goh.ORDER_NO,
goh.OMEGA_ORDER_NUMBER,
goh.ORDER_TYPE,
gc.CUSTOMER_ID,
gc.OMEGA_CUSTOMER_NUMBER,
CASE WHEN gc.PRIVATE = 'N' THEN gc.CUSTOMER_NAME ELSE '' END
AS COMPANY_NAME,
goh.ORDER_STATUS,
goh.TOTAL_SELLING_PRICE,
goh.TOTAL_MARGIN,
ga1.ADDRESS1
|| ','
|| ga1.ADDRESS2
|| ','
|| ga1.ADDRESS3
|| ','
|| ga1.POSTAL_CODE
|| ','
|| ga1.CITY
AS SHIPPING_ADDRESS,
ga2.ADDRESS1
|| ','
|| ga2.ADDRESS2
|| ','
|| ga2.ADDRESS3
|| ','
|| ga2.POSTAL_CODE
|| ','
|| ga2.CITY
AS BILLING_ADDRESS,
ga.ADDRESS_ID,
gol.DESCRIPTION,
APPS_JP.TZ.to_local_date (goh.OFFER_DATE, goh.OFFER_DATE_UTC)
AS OFFER_DATE,
gc.LEVEL_8,
goh.NO_OF_BUILDS,
gob.SFDC_ID,
goh.PURCHASE_ORDER_NO AS PO,
gc1.CUSTOMER_NAME AS END_USAGE,
gol.LOB,
goh.TOTAL_MARGIN_PCT,
goh.TOTAL_DISCOUNT,
goh.TOTAL_DISCOUNT_PCT
FROM APPS_JP.GEDIS_OFFER_HEADER goh,
APPS_JP.GEDIS_ORDER_BUILDS gob,
APPS_JP.GEDIS_ORDER_LINES gol,
APPS_JP.GEDIS_OFFER_RELATED_CUSTOMER gorc,
APPS_JP.GEDIS_OFFER_RELATED_CUSTOMER ship,
APPS_JP.GEDIS_OFFER_RELATED_CUSTOMER bill,
APPS_JP.GEDIS_CUSTOMER gc,
APPS_JP.GEDIS_CUSTOMER gc1,
APPS_JP.GEDIS_CONTACT gct,
APPS_JP.GEDIS_ADDRESS ga,
APPS_JP.GEDIS_ADDRESS_NORM ga1,
APPS_JP.GEDIS_ADDRESS_NORM ga2,
(SELECT DISTINCT SALESPERSON_ID, USER_NAME
FROM APPS_JP.GEDIS_SALESPERSON
WHERE SALESPERSON_ID IN
(SELECT TO_NUMBER (COLUMN_VALUE) AS SALESPERSON_ID
FROM TABLE (APPS_GLOBAL.SplitString ('337309'))))
gsp
WHERE goh.ORDER_NO <> 0
AND goh.OFFER_NO <> 0
AND goh.OFFER_NO=gol.OFFER_NO
AND gol.BUILD_NO = 1
AND gol.LINE_NO = 1
AND goh.OFFER_NO=gob.OFFER_NO
AND gob.BUILD_NO = 1
AND goh.OFFER_NO = gorc.OFFER_NO
AND gct.CONTACT_ID = gorc.CONTACT_ID
AND ga.CUSTOMER_ID = gc.CUSTOMER_ID
AND ga.PRIMARY = 'Y'
AND goh.LEAD_SALESPERSON=gsp.SALESPERSON_ID
AND goh.OFFER_NO = ship.OFFER_NO
AND ship.RELATION_TYPE = 'SHIP'
AND ga1.ADDRESS_ID = ship.ADDRESS_ID
AND ga1.CUSTOMER_ID = gc1.CUSTOMER_ID
AND goh.OFFER_NO = bill.OFFER_NO
AND bill.RELATION_TYPE = 'BILL'
AND ga2.ADDRESS_ID = bill.ADDRESS_ID
AND goh.OFFER_DATE BETWEEN APPS_JP.TZ.LOCAL_TO_DB_DATE (
SYSDATE - 30
AND APPS_JP.TZ.LOCAL_TO_DB_DATE (SYSDATE)
AND gorc.RELATION_TYPE = 'BASE'
AND gorc.CUSTOMER_ID = gc.CUSTOMER_ID
AND goh.SALES_CHANNEL = gc.SALES_CHANNEL
AND gc.SALES_CHANNEL = 'SMB'
AND goh.LEAD_SALESPERSON IN (goh.CREATED_BY, goh.LEAD_SALESPERSON)
ORDER BY goh.OFFER_NO;[/code]
Please help me how to use this outer join condition.
Thanks in advance.Hi,
If you want all the rows from goh, then you don't want any conditions like goh.OFFER_NO <> 0.
Make all the joins to goh outer joins, and make all conditions that apply to any tables joined to goh (or to tables joined to them) part of the join condition, like this:
FROM APPS_JP.GEDIS_OFFER_HEADER goh
LEFT OUTER JOIN APPS_JP.GEDIS_ORDER_BUILDS gob ON gob.OFFER_NO = goh.OFFER_NO
AND gob.BUILD_NO = 1
LEFT OUTER JOIN APPS_JP.GEDIS_ORDER_LINES gol ON gol.OFFER_NO = goh.OFFER_NO
AND gol.BUILD_NO = 1
AND gol.LINE_NO = 1
LEFT OUTER JOIN APPS_JP.GEDIS_OFFER_RELATED_CUSTOMER
gorc ...
I hope this answers your question.
If not, post a little sample data (CREATE TABLE and INSERT statements, relevant columns only) for all the tables involved, and the results you want from that data.
Simplify the problem as much as possible. For example, do you really need all those tables to show what the problem is? Of course, you need them in tyour real query, but if you understand a solution that only involves 4 or 5 tables, you'll know how to apply it to any number of tables.
Explain, using specific examples, how you get those results from that data.Always say what version of Oracle you're using (e.g. 11.2.0.2.0).
See the forum FAQ https://forums.oracle.com/message/9362002#9362002 -
How to use outer join in Corelated Update?
Hi,
I am using outer join in correlated update comand. But it is not updating the line which is not retrived from the query. Below is the example.
Update model_table a
Set a.model = (Select b.model_name from parts_table b
where b.model_id (+) = a.model_id)Check the above query and please let me know whether can user like this or not?
ThanksUpdating the values you want through subqueries is tricky. The correlated update should perform okay if the join columns are indexed but updating the correct rows may take some thought.
You might need to add a WHERE clause to the update to use the subquery to only update the rows when the subquery return value is not null - if this is what you want. Something like
Update model_table a
Set a.model = (Select b.model_name from parts_table b
where b.model_id = a.model_id)
where exists (Select b.model_name from parts_table b
where b.model_id = a.model_id)Edited by: riedelme on Jan 4, 2010 5:59 AM -
I Dont Want To Use The Bounce Feature Anymore : ( Is There Another Way?
Hey Guys!
Im convinced that the bounce feature takes a little something away from your sound of your file. I there a way i can mixdown my song in realtime without using the "bounce" feature. I love WaveBurner but im sure i cant record my project straight to it in "realtime".
A friend of mine says he takes his multitrack project, output it from the soundcard from computer (A) to computer (B) inputs, realtime record it onto a stereo track (most of the time to a 96K format). and then burn THAT file to cd.
That sounds cool i guess but i dont want to run out a buy another computer and soundcard just to achieve this!
Any suggestions?Have you tried recording back into the same song, onto a new stereo track?
So for instance, go out of your interface, back into your interface, with the new stereo track's inputs set to match. Word of caution... MUTE that stereo track that you will be recording to, or at the very least, turn software monitoring off, or set it's output to "no output".
However, in my experience, the only thing you'll gain from doing that is an extra conversion step, which is never ideal.
Also... how hard are you hitting your main output in Logic? If it's at 0dB, or close to it, that very well may be part of the problem, or why you may feel things sound "wrong". If you are mixing entirely "in the box", keep all your levels VERY conservative, and try to make the loudest points in the song peak out at -6dB or -7dB.
Someone else can explain the technical details... but this practice is important to observe when working in the box entirely. Once I started to adhere to it, my mixes were much more "open", and dynamic. It truly made a huge difference to the sound.
And the lower volume can be made up for in mastering.
If you need a Masterlink, let me know. I have one in mint condition, that I simply do not use anymore. It'll be priced to sell... -
How can I sync my Microsoft Outlook tasks with my Ipad reminders? I dont want to use Icloud or an exchange
Plug it into your computer. Tell it to sync with "this computer" instead of iCloud. You shouldn't have to remove any apps. Otherwise, you can save the app data by using i-FunBox ( http://www.i-funbox.com/ ) just go to the "devices" tab and select 'user applications' and select all of your apps and tell iFunBox to "copy to pc" you're done! You have them all backed up.
-
Logical database EQI (equipment) .. I dont want to use the default selecti
i am using Logical database EQI (equipment) its realated to PM module.....
i dont want to use the default selection screen.
instead i want to process my own selection screen inputs..
(ie..) i want to fetch the data using the GET event using my own selection screen inputs.
my selection screen inputs is equipmentnumber (equnr)
and the output list : 1.equnr "equipment number
2.shtxt "Equipment Description
3.tplnr "Functional Location
4.pltxt "Functional Location Description
5.qmnum "Notification Number
6.qmtxt "Notification Description
and so on ..........
how to do this ... can any one give sample code... or logicHi Victor,
I have a simple solution for this.i think it will help you.Do u have any idea about query designer in SAP.
by using it we can satisfy u r reuqirement.follow the below steps.
1)Go to SQ01
2)In the screen click on QuickViewer option.then you will go to another screen.
3)In that screen give any name starting with 'Z' in the QuickView box and then click on create.
4)In the dialogbox enter title and comments and then select LogicalDatabase as the DATASOURCE and give DataSourceLogicalDatabase as EQI.check the radio button Basis Mode and then click on ok.
5)then on the screen in the first half of leftside you will get another screen with the columns DATAFIELDS,LISTFIELDS,SELECTIONFIELDS,TECHNICALNAME.
6)In the DATAFIELDS column expand the tree,then u can see the fields what we have,and what you want.and also you can see the check boxes in front of the columns LISTFIELDS,SELECTIONFIELDS.
7)LISTFIELDS means the output fields,SELECTIONFIELDS means the selection screen fields(equnr).
check the checkboxes as per u r requirement and click on execute.
8)then a progam will be created.to know the program name after executing the program GO TO
SYSTEM->STATUS.then u can see the program name there.
If u know all these,let me know so that i can try for another solution.
Thanks,
N.K.C -
Safari on windows stinks but I dont want to use chrome as all my bookmarks and passwords are on safari now, but im finding now i use chrome on my os devices justso that my windows computer at work is useful.. Why wont apple support safari for user like mew who want to use it
Apple dropped support for Safari for Windows several years ago. Try Firefox.
Firefox -
HTC Desire
Android: 2.2 (stock)
Build: 2.29.405.5
KeyBord: SwiftKey (newest version)
Every time i try to fill a textfield on a homepage swiftkey crashes. But i can type in a internet-adress without any problems. If i use any other Keybord all work fine, but i dont want to use any other Keybord than SwiftKey.Thanks for the report. We are working on this problem; for details see https://bugzilla.mozilla.org/show_bug.cgi?id=617298
-
ibook stopped transferring images via image capture. last month it worked. i hav an old ibook and i cannot update to newest itunes. which is fine. however, i need the image capture to take photos off my iphone 5. no, i dont want to use i cloud. i would actually like to just plug it in to the usb drive the old fashioned way
I don't believe the iOS7 update was the cause for your issue. I have three devices all updated and they all show the Import To drop menu in Image Capture as shown below.
-
How to use outer join on 3 tables
how to use outer join on 3 tables
say tables are mkpf,lips and vbrp
mkpf-xblnr = lips-vbeln
lips-vbeln = vbrp-vgbelrefer following querry
select a~bukrs
a~anln1
a~ord42
a~ord43
b~afabe
b~ndabj
b~kaafa
b~aafag
c~kostl
d~afasl
d~ndjar
d~ndper
into corresponding fields of table gt_master
from ( ( anla as a inner join anlc as b
on abukrs = bbukrs
and aanln1 = banln1
and aanln2 = banln2 )
inner join anlz as c
on abukrs = cbukrs
and aanln1 = canln1
and aanln2 = canln2 )
inner join anlb as d
on abukrs = dbukrs
and aanln1 = danln1
and aanln2 = danln2
where a~bukrs in s_comp. -
Sample code and senarios to use outer join?
We know the ABAP4 syntax for inner join, but never tried outer join and we even don't know if there is any outer join syntax in ABAP4 or not. Would be very appreciated if some ABAP expert here let us know if there is any outer join and list the difference between inner join and outer join with detailed senarios or when we would use outer join or when to use inner join? Also give a sample code on the outer join if there is any in ABAP?
Thanks and we will give you reward points!Hye..
Left outer join between table 1 and table 2 where column D in both tables set the join condition:
Table 1 Table 2
A
B
C
D
D
E
F
G
H
a1
b1
c1
1
1
e1
f1
g1
h1
a2
b2
c2
1
3
e2
f2
g2
h2
a3
b3
c3
2
4
e3
f3
g3
h3
a4
b4
c4
3
|--|||--|
Left Outer Join
|--||||||||--|
| A | B | C | D | D | E | F | G | H |
|--||||||||--|
| a1 | b1 | c1 | 1 | 1 | e1 | f1 | g1 | h1 |
| a2 | b2 | c2 | 1 | 1 | e1 | f1 | g1 | h1 |
| a3 | b3 | c3 | 2 |NULL|NULL|NULL|NULL|NULL|
| a4 | b4 | c4 | 3 | 3 | e2 | f2 | g2 | h2 |
|--||||||||--|
Example
Output a list of all custimers with their bookings for October 15th, 2001:
DATA: CUSTOMER TYPE SCUSTOM,
BOOKING TYPE SBOOK.
SELECT SCUSTOMNAME SCUSTOMPOSTCODE SCUSTOM~CITY
SBOOKFLDATE SBOOKCARRID SBOOKCONNID SBOOKBOOKID
INTO (CUSTOMER-NAME, CUSTOMER-POSTCODE, CUSTOMER-CITY,
BOOKING-FLDATE, BOOKING-CARRID, BOOKING-CONNID,
BOOKING-BOOKID)
FROM SCUSTOM LEFT OUTER JOIN SBOOK
ON SCUSTOMID = SBOOKCUSTOMID AND
SBOOK~FLDATE = '20011015'
ORDER BY SCUSTOMNAME SBOOKFLDATE.
WRITE: / CUSTOMER-NAME, CUSTOMER-POSTCODE, CUSTOMER-CITY,
BOOKING-FLDATE, BOOKING-CARRID, BOOKING-CONNID,
BOOKING-BOOKID.
ENDSELECT.
Reward if helpful.
Thanks.
Imran. -
I dont want to use adobe catalyst with my adobe muse forms!
I dont want to use adobe catalyst with my adobe muse forms!
I dont want to use third party plugins... Why? When I already bought Adobe Muse.
I just want to create a form in MUSE and have it simple and working - without catalyst.So its really very good news for me, I will try it this week.
Thanks a lot mac_heibu, sorry for mismatch information.
You made my day, bro. -
if we dont want to use sleep/wakeup button for dissconnect the call so there is any other option for dissconnect the call without using sleep/wakeup button in ios 8.1.3 . kindly suggest..!
Hello kumar kalptaru,
Thank you for participating in the Apple Support Communities.
It sounds like you're wondering how to hang up a call besides using the Sleep/Wake button.
Other than this, you can tap the red hang up button on the Phone app. See the iPhone User Guide for more help:
While on a call - iPhone
End a call. Tap or press the Sleep/Wake button.
Best Regards,
Jeremy
Maybe you are looking for
-
Mail only downloads one mail at a time from Gmail
I have a gmail email account and read it using Apple Mail. This used to work fine: every time I connected, all my mails were downloaded in one go. Recently, something has changed (all my settings are the same) and now only one mail is downloaded at a
-
I like to have certain shortcuts on my task bar for easy access. I have created a shortcut for my email address and it is on the desktop but when I try to drag it to my task bar, it will not stay because the message says it is pinned to Firefox. Is t
-
Hi, I was trying to practically test the example given in http://java.sun.com/products/jndi/tutorial/objects/storing/remote.htmlBasically, i was trying this : "Binding a Remote Object That Uses IIOP". I managed to bind my InitialContext object and wa
-
Is it possible to add action to JLable component?
Is it possible to add action to JLable component?
-
IMovie 11 crashes when exporting to Quicktime
iMovie 11 crashes when exporting to Quicktime. Some people have posted that this problem disappeared when they upgraded from Lion to Mountain Lion. However, I am running Mt.Lion and it still happens. If there is no fix for this bug, does anyone kn