Inner join in select statement
hi,
i am using select statement like
SELECT ekkoebeln ekkobukrs ekkobstyp ekkobsart ekko~ernam
ekkolifnr ekkozterm ekkozbd1t ekkozbd2t ekko~zbd3t
ekkozbd1p ekkozbd2p ekkoekorg ekkoekgrp ekko~waers
ekkowkurs ekkokufix ekkobedat ekkokdate
Begin of Changes, RICEF : 293.
ekkozzhedg ekkozzheda ekkozzpba ekkozzpbubu lfa1~vbund
End of Changes, RICEF . 293.
lfa1land1 lfa1name1
ekpa~lifn2
INTO CORRESPONDING FIELDS OF TABLE iekko
FROM ekko
JOIN lfa1 ON lfa1lifnr = ekkolifnr
LEFT JOIN ekpa ON ekpaebeln = ekkoebeln AND
ekpa~ebelp = '00000' AND
ekpa~parvw = 'RS'
FOR ALL entries IN icooi
WHERE ekko~ebeln = icooi-refbn
AND ekko~zzhedg IN s_zzhedg
AND ekko~zzheda IN s_zzheda.
where in ekko table ,the fields zzhedg and zzheda are appended..but in the debugging mode i am unable to see this 2 field....in the output also....so how should i write my select query?
Hi,
Is your select statement returning sy-subrc 0. In debugging mode may be your fields may not be visible in the screen since your internal table has many fields, you have to press >> forward button to check the fields.
Thanks & Regards,
Navneeth K.
Similar Messages
-
What is syntax for inner join of Select statement with Secondary Index
Hi Genies,
Here i have created the Secondary index for table COEP and also used for select query but there is no improvement in runtime . taking same time for select query without index as well as with index. my code is
SELECT * INTO CORRESPONDING FIELDS OF TABLE ITAB_COEP FROM COEP AS A
INNER JOIN COBK AS B ON ( A~BELNR = B~BELNR AND A~KOKRS = B~KOKRS AND A~GJAHR = B~GJAHR )
WHERE A~OBJNR = OBJNR
AND A~GJAHR = CURRY
AND B~GJAHR = CURRY
AND A~RBEST = ''
AND A~BEKNZ = 'S'
AND B~BELNR NE WA_COBK-BELNR
AND B~AWREF_REV = ''
AND B~AWORG_REV = ''
AND B~KOKRS = WA_COIOB-KOKRS
AND B~BLDAT BETWEEN START_DATE AND END_DATE
AND B~BLART IN ('SA','KA','KR','AB') %_HINTS ORACLE 'INDEX("COEP" "COEP~ZBU")'.
index name is ZBU.
please any one let me know is there any syntax mistakes? but while checking and during the runtime it does'nt shows any error.
Regards,
Thangam.PHi Genies,
Here i have created the Secondary index for table COEP and also used for select query but there is no improvement in runtime . taking same time for select query without index as well as with index. my code is
SELECT * INTO CORRESPONDING FIELDS OF TABLE ITAB_COEP FROM COEP AS A
INNER JOIN COBK AS B ON ( A~BELNR = B~BELNR AND A~KOKRS = B~KOKRS AND A~GJAHR = B~GJAHR )
WHERE A~OBJNR = OBJNR
AND A~GJAHR = CURRY
AND B~GJAHR = CURRY
AND A~RBEST = ''
AND A~BEKNZ = 'S'
AND B~BELNR NE WA_COBK-BELNR
AND B~AWREF_REV = ''
AND B~AWORG_REV = ''
AND B~KOKRS = WA_COIOB-KOKRS
AND B~BLDAT BETWEEN START_DATE AND END_DATE
AND B~BLART IN ('SA','KA','KR','AB') %_HINTS ORACLE 'INDEX("COEP" "COEP~ZBU")'.
index name is ZBU.
please any one let me know is there any syntax mistakes? but while checking and during the runtime it does'nt shows any error.
Regards,
Thangam.P -
Inner join and select for all entries with respect to performance
Hi Friends,
I just want to know which is more efficient with respect to performance the Inner join or select for all entries?which is more efficient? and how? can you explain me in detail ?
Regards,
DineshINNER JOIN->
The data that can be selected with a view depends primarily on whether the view implements an inner join or an outer join. With an inner join, you only get the records of the cross-product for which there is an entry in all tables used in the view. With an outer join, records are also selected for which there is no entry in some of the tables used in the view.
http://help.sap.com/saphelp_nw2004s/helpdata/en/cf/21ec77446011d189700000e8322d00/content.htm
FOR ALL ENTRIES->
Outer join can be created using this addition to the where clause in a select statement. It speeds up the performance tremendously, but the cons of using this variation are listed below
Duplicates are automatically removed from the resulting data set. Hence care should be taken that the unique key of the detail line items should be given in the select statement.
If the table on which the For All Entries IN clause is based is empty, all rows are selected into the destination table. Hence it is advisable to check before-hand that the first table is not empty.
If the table on which the For All Entries IN clause is based is very large, the performance will go down instead of improving. Hence attempt should be made to keep the table size to a moderate level.
Not Recommended
Loop at int_cntry.
Select single * from zfligh into int_fligh
where cntry = int_cntry-cntry.
Append int_fligh.
Endloop.
Recommended
Select * from zfligh appending table int_fligh
For all entries in int_cntry
Where cntry = int_cntry-cntry. -
Inner join and select for all entries with respect to performance in SAP
Hi Friends,
I just want to know which is more efficient with respect to performance the Inner join or select for all entries?which is more efficient?
Regards,
DineshI did some testing a while ago and found that a JOIN is usually a bit more efficient than FOR ALL ENTRIES. This wasn't always the case though, so the best thing to do is to write it both ways and see which is faster.
Rob -
Inner join with if statement , how to combine these code ?
Hello everyone, I have 2 group of code here. This 2 group of code is working without error. But I face a problem , I need to group up this 2 group of code. Please take a look, thank you This is the first code i create.
SELECT r.Name , r.Restaurant_ID, f.feature, r.Price_Range, r.Cuisine_ID, c.Cuisine,
s.State_ID, s.State, l.Location_ID, l.Area, l.State_ID, r.Name, r.Location_ID
FROM Restaurants r, Bridge1_Restaurant_Features b, Features f, Cuisine c, State s, Location l
where 0=0
AND b.Feature_ID = f.Feature_ID
AND b.Restaurant_ID = r.Restaurant_ID
AND r.Cuisine_ID = c.Cuisine_ID
AND r.Location_ID = l.Location_ID
AND l.State_ID = s.State_ID
<cfif ARGUMENTS.Feature_ID IS NOT "">
AND b.Feature_ID IN (#ARGUMENTS.Feature_ID#)
</cfif>
<cfif ARGUMENTS.Price_Range IS NOT "">
AND r.Price_Range IN (#ARGUMENTS.Price_Range#)
</cfif>
<cfif ARGUMENTS.Cuisine IS NOT "">
AND r.Cuisine_ID = (#ARGUMENTS.Cuisine#)
</cfif>
<cfif val(ARGUMENTS.LocationID2) IS #val(ARGUMENTS.StateID)#>
AND l.State_ID = #val(ARGUMENTS.LocationID2)#
<cfelse>
AND l.Location_ID = #val(ARGUMENTS.LocationID2)#
</cfif>
Then, I notice the feature_ID i need to use another logic to show the result. The code is like this
SELECT r.Restaurant_ID, r.Name, f.Feature
FROM Restaurants r
INNER JOIN Bridge1_Restaurant_Features b ON b.Restaurant_ID = r.Restaurant_ID
INNER JOIN Features f ON b.Feature_ID = f.Feature_ID
INNER JOIN
SELECT Restaurant_ID, COUNT(Feature_ID) AS FeatureCount
FROM Bridge1_Restaurant_Features
<!--- find matching features --->
WHERE Feature_ID IN ( <cfqueryparam value="#ARGUMENTS.Feature_ID#" cfsqltype="cf_sql_integer" list="true"> )
GROUP BY Restaurant_ID
<!--- having ALL of the requested features --->
HAVING COUNT(Feature_ID) = <cfqueryparam value="#listLen(ARGUMENTS.Feature_ID)#" cfsqltype="cf_sql_integer">
) ck ON ck.Restaurant_ID = r.Restaurant_Id
I want combine this 2 group together. The second group have to replace
<cfif ARGUMENTS.Feature_ID IS NOT "">
AND f.Feature_ID IN (#ARGUMENTS.Feature_ID#)
</cfif>
I try few way to group this 2 code, but fail to make it. The code i try is on below, it get error.
SELECT r.Name , r.Restaurant_ID, f.feature, r.Price_Range, r.Cuisine_ID, c.Cuisine,
s.State_ID, s.State, l.Location_ID, l.Area, l.State_ID, r.Location_ID
FROM Restaurants r, Features f, Cuisine c, State s, Location l
INNER JOIN Bridge1_Restaurant_Features b ON b.Restaurant_ID = r.Restaurant_ID
INNER JOIN Features f ON b.Feature_ID = f.Feature_ID
AND r.Cuisine_ID = c.Cuisine_ID
AND r.Location_ID = l.Location_ID
AND l.State_ID = s.State_ID
<cfif ARGUMENTS.Feature_ID IS NOT "">
INNER JOIN
SELECT Restaurant_ID, COUNT(Feature_ID) AS FeatureCount
FROM Bridge1_Restaurant_Features
<!--- find matching features --->
WHERE Feature_ID IN ( <cfqueryparam value="#ARGUMENTS.Feature_ID#" cfsqltype="cf_sql_integer" list="true"> )
GROUP BY Restaurant_ID
<!--- having ALL of the requested features --->
HAVING COUNT(Feature_ID) = <cfqueryparam value="#listLen(ARGUMENTS.Feature_ID)#" cfsqltype="cf_sql_integer">
) ck ON ck.Restaurant_ID = r.Restaurant_Id
</cfif>
<cfif ARGUMENTS.Price_Range IS NOT "">
AND r.Price_Range IN (#ARGUMENTS.Price_Range#)
</cfif>
<cfif ARGUMENTS.Cuisine IS NOT "">
AND r.Cuisine_ID = (#ARGUMENTS.Cuisine#)
</cfif>
<cfif val(ARGUMENTS.LocationID2) IS #val(ARGUMENTS.StateID)#>
AND l.State_ID = #val(ARGUMENTS.LocationID2)#
<cfelse>
AND l.Location_ID = #val(ARGUMENTS.LocationID2)#
</cfif>Yeah Adam I am listen to you ! But Finally i solve it.
This is the code i solve .
SELECT r.Restaurant_ID, r.Name, f.Feature, r.Price_Range, r.Cuisine_ID, c.Cuisine,
l.Location_ID, l.Area, s.State
FROM Restaurants r
<cfif ARGUMENTS.Feature_ID IS NOT "">
INNER JOIN
SELECT Restaurant_ID, COUNT(Feature_ID) AS FeatureCount
FROM Bridge1_Restaurant_Features
<!--- find matching features --->
WHERE Feature_ID IN ( <cfqueryparam value="#ARGUMENTS.Feature_ID#" cfsqltype="cf_sql_integer" list="true"> )
GROUP BY Restaurant_ID
<!--- having ALL of the requested features --->
HAVING COUNT(Feature_ID) = <cfqueryparam value="#listLen(ARGUMENTS.Feature_ID)#" cfsqltype="cf_sql_integer">
) ck ON ck.Restaurant_ID = r.Restaurant_Id
</cfif>
INNER JOIN Location l ON r.Location_ID = l.Location_ID
INNER JOIN State s ON l.State_ID = s.State_ID
INNER JOIN Cuisine c ON r.Cuisine_ID = c.Cuisine_ID
INNER JOIN Bridge1_Restaurant_Features b ON b.Restaurant_ID = r.Restaurant_ID
INNER JOIN Features f ON b.Feature_ID = f.Feature_ID
<cfif ARGUMENTS.Cuisine IS NOT "">
AND r.Cuisine_ID = (#ARGUMENTS.Cuisine#)
</cfif>
<cfif ARGUMENTS.Price_Range IS NOT "">
AND r.Price_Range IN (#ARGUMENTS.Price_Range#)
</cfif>
<cfif val(ARGUMENTS.LocationID2) IS #val(ARGUMENTS.StateID)#>
AND l.State_ID = #val(ARGUMENTS.LocationID2)#
<cfelse>
AND l.Location_ID = #val(ARGUMENTS.LocationID2)#
</cfif>
Is it the code can be improve more ? -
Default join in select statements
Hi guyz,
If I am using just Join in my select statement. What does it do by default
1. innter join
2. outer join
eg:
select vbeln posnr into table itab from vbak <b>join</b> vbap on vbakvbeln = vbapvbeln.
Thanks.Mgs,
By Default innerjoin.
See the diff.
Hi karan check also the "left outer join" statement.
It might help you if you need 1-N relation
// left outer Join
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 |
|--||||||||--|
// Inner Join
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
Inner 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
a4
b4
c4
3
3
e2
f2
g2
h2
Pls. mark if useful -
Time taking for inner joins in select
Hi all,
I am using inner join on 3 tables ( PLKO,PLPO,PLAS) for the materials,
it is taking database time 20% and abap time 78 % and when i am using FM CARO_ROUTING_READ
database time 48% and abap 52%.
i am in confusion which is th ebest method to use inner join or FM.
when i am checking in the server for plant in the selection screen , it is running lot of time
This is first time i am working on the performance issue.
Can you please anbody help me how to solve this issue.
Regards,
MadhaviPercentages don't mean much, how does the overall runtime compare? Is there a problem at all?
Since you already used SE30, go a step further and study the hit list sorted by net time descending, only look at the top few items.
Also read this:
Please Read before Posting in the Performance and Tuning Forum
Thomas -
Hi All,
I have 9 select Statements,i can combine these queries by 'UNION' to get the result....but the process will be tedious.
Is there any other option to do the same in a easy way.
Example :
SELECT ecv.creation_date "Initiation Date",
eceb.c_ext_attr1 "REPORTING PERSON",
eceb.c_ext_attr2 INITIATOR,
eceb.c_ext_attr3 "REPORTING PERSON TITLE",
eceb.d_ext_attr2 "AWARE DATE",
eceb.c_ext_attr4 TELEPHONE
FROM eng_changes_v ecv,
eng_changes_ext_b eceb
WHERE ecv.change_id = eceb.change_id
AND ecv.change_notice = 'COM-10034'
AND attr_group_id = 266;
UNION
SELECT eceb.c_ext_attr2 TYPE,
eceb.c_ext_attr3 INSTITUTION,
eceb.c_ext_attr4 TERRITORY,
eceb.c_ext_attr5 "CUSTOMER NAME",
eceb.c_ext_attr6 TITLE,
eceb.c_ext_attr7 ADDRESS,
eceb.c_ext_attr8 "ADDRESS 2",
eceb.c_ext_attr9 CITY,
eceb.c_ext_attr10 STATE,
eceb.n_ext_attr1 ZIP,
eceb.c_ext_attr11 COUNTRY,
eceb.c_ext_attr12 TELEPHONE,
eceb.c_ext_attr13 FAX
FROM eng_changes_v ecv,
eng_changes_ext_b eceb
WHERE ecv.change_id = eceb.change_id
AND ecv.change_notice = 'COM-10034'
AND attr_group_id = 267;
In this fashion i have 9 select statements.
Thanks in advance!
RamyaWell, this is not the silly EAV model …
but it does look as something that has been slightly abused on the dynamic/generic side.
You certainly do not want to UNION … it wouldn’t make sense anyway.
Think of your ATTR_GROUP_ID as identifiers of what could have been real tables
(dependents of ENG_CHANGES_V):
create view could_be_table_266 as
select change_id
,c_ext_attr1 REPORTING_PERSON
,c_ext_attr2 INITIATOR
,c_ext_attr3 REPORTING_PERSON_TITLE
,d_ext_attr2 AWARE_DATE
,c_ext_attr4 TELEPHONE
from eng_changes_ext_b
where attr_group_id = 266
create view could_be_table_267 as
select change_id
,c_ext_attr2 TYPE
,c_ext_attr3 INSTITUTION
,c_ext_attr4 TERRITORY
,c_ext_attr5 CUSTOMER NAME
,c_ext_attr6 TITLE
,c_ext_attr7 ADDRESS
,c_ext_attr8 ADDRESS_2
,c_ext_attr9 CITY
,c_ext_attr10 STATE
,n_ext_attr1 ZIP
,c_ext_attr11 COUNTRY
,c_ext_attr12 TELEPHONE
,c_ext_attr13 FAX
from eng_changes_ext_b
where attr_group_id = 267
Then join using your knowledge of what the “logical” relationship between these table would be … likely
select <columns_you_need_from x>
,<columns_you_need_from a>
,<columns_you_need_from b>
from eng_changes_v x
,could_be_table_266 a
,could_be_table_267 b
where x.change_id = a.change_id (+)
and x.change_id = b.change_id (+)
and x.change_notice = 'COM-10034'
Using column names like "REPORTING PERSON" rather than REPORTING_PERSON is just a pain in the …
What column headings one wants in a report/screen doesn’t have to drive the names of select list items in SQL.
TYPE is likely not a good name … reserved word -
Join a SELECT-Statement with a INDEX
can I force a SELECT-Statement to use a certain Table-INDEX?
f.e.
select * from table a
where a.key like '%p'
..forced index a.idx.--Yes. You can.
Use SQL hint.
select /*+ index (tablename indexname) */.
If the index is usable-Oracle will use it. If not -Oracle will see it as a remark. -
Maximum number of joins in SELECT statement
Dear friends,
Can you tell me, how many max number of joins (inner & outer) we can make in ABAP.
For eg:
table 1: A B C fields
table 2: C D E fields
table 3: E F G fileds..............
Thanks in advance for your valuable time.
Best regards,
Satishhi,
no limit for joins[inner or outer ] in a table , when we consider performance issue joins will reduce the performance of our program so go views instead of joins.
with cheers,
suresh babu aluri. -
dear friends
kna1- kunnr ,name1
vbak - vbeln , erdat
vbap - meins , kwmeng
on above i have given three tables and their fields in front of this
can any one tel me how to give inner join in select statement for the above tablesHi Create an appropriate internal table ITAB
Select VBAK~VBELN
VBAK~ERDAT
VBAP~POSNR
VBAP~MEINS
VBAP~kwmeng
KNA1~KUNNR
KNA1~NAME1
From VBAK
Into Table ITAB
Inner Join VBAP On VBAKVBELN = VBAPVBELN
Inner Join KNA1 On VBAK~KUNNR = KNA1-KUNNR
Where VBAK~VBELN In S_VBELN.
Santhosh -
hi friends,
can we use where clause in select statement with inner join.
i am using following code which gives error (The column name "WERKS" has two meanings . .).
SELECT AMATNR ACHARG AERSDA BMENGE B~MEINS
FROM MCHA AS A INNER JOIN CHVW AS B
ON ACHARG = BCHARG
INTO TABLE T_OUTPUT1
WHERE WERKS = PLANT AND CHARG = P_CHARG.
thanks.Yes u can use where clause in select statement with inner join.
SELECT AMATNR ACHARG AERSDA BMENGE B~MEINS
FROM MCHA AS A INNER JOIN CHVW AS B
ON ACHARG = BCHARG
INTO TABLE T_OUTPUT1
WHERE WERKS = PLANT AND CHARG = P_CHARG.
" mention the table name in where condition also like awerks or bwerks.
egards
Rajendra -
Hello
What is the best programming, putting selection in the inner join or in where clause. Below is some sample code that works but wondering if C~statu='X' would have been better in the Where part of the statement in stead as part of the inner join? Maybe don't need the Where in this select statment just code in the inner joins?
SELECT algnum abdatu btanum btapos atbnum btbpos b~werks
blgort bmatnr bmeins bmaktx bvsolm bvltyp b~vlpla
b~nlpla
INTO TABLE gt_ltak
FROM ltak AS a
INNER JOIN ltap AS b ON blgnum = algnum AND
btanum = atanum
INNER JOIN lrf_wkqu AS c ON clgnum = algnum AND
c~bname = sy-uname AND
cqueue = aqueue AND
c~statu = 'X'
INNER JOIN zis_prog_vars AS d ON d~pgm = 'ZRF_TRANS_03_0100' AND
d~fld = l_priority AND
dval1 = atbpri
WHERE a~lgnum = '170' AND
a~tanum = '0000001399'.Hi,
Herewith the corrected version:
SELECT a~lgnum a~bdatu b~tanum b~tapos a~tbnum b~tbpos b~werks
b~lgort b~matnr b~meins b~maktx b~vsolm b~vltyp b~vlpla b~nlpla
INTO TABLE gt_ltak
FROM ltak AS a
INNER JOIN ltap AS b ON b~lgnum = a~lgnum AND
b~tanum = a~tanum
INNER JOIN lrf_wkqu AS c ON c~lgnum = a~lgnum AND
c~queue = a~queue AND
INNER JOIN zis_prog_vars AS d ON d~val1 = a~tbpri
WHERE a~lgnum = '170'
AND a~tanum = '0000001399'
AND c~bname = sy-uname
AND c~statu = 'X'
AND d~pgm = 'ZRF_TRANS_03_0100'
AND d~fld = l_priority.
Kr,
m. -
hello all,
Below is a inner join query
SELECT aebeln aebelp apackno bzekkn b~ps_psp_pnr
FROM ( ( ekpo AS a INNER JOIN ekkn AS b
ON aebeln = bebeln
AND aebelp = bebelp )
INNER JOIN prps AS c
ON bps_psp_pnr = cpspnr )
INTO TABLE t_wbspo
WHERE a~ebeln IN s_ebeln
AND c~psphi IN s_psphi
AND stufe = c_task.
I want to modify this select and put one more join on ekkn-aufnr
and aufk-afunr .
Now for this i write the below code
SELECT aebeln aebelp apackno bzekkn bps_psp_pnr baufnr
FROM ( ( ( ekpo AS a INNER JOIN ekkn AS b
ON aebeln = bebeln
AND aebelp = bebelp )
INNER JOIN prps AS c
ON bps_psp_pnr = cpspnr )
INNER JOIN aufk AS d
ON baufnr = daufnr )
INTO TABLE t_wbspo
WHERE a~ebeln IN s_ebeln
AND c~psphi IN s_psphi
AND d~aufnr IN s_aufnr
AND stufe = c_task.
By the above way does it puts a join on ekkn-aufnr and aufk-aufnr ?
Is the above way the right way to do it ?
Please confirm
regardsHello Bhanu,
Do you face any performance issue? Query looks good now, further you can refer to following threads to know more on JOIN-
Re: Inner join
http://help.sap.com/saphelp_nw04/helpdata/en/cf/21ec77446011d189700000e8322d00/frameset.htm
Thank You,
Nishikant Kumbhar. -
Performance in Inner Join on VBAK
HI,
For a customized report the select statement was written like this which is giving time out error for large data. How one can improve performance of following Inner Joins.
SELECT *
INTO CORRESPONDING FIELDS OF TABLE it_tab
FROM vbak as A INNER JOIN vbuk as B
ON Avbeln = Bvbeln
INNER JOIN vbkd as C
ON Avbeln = Cvbeln
WHERE A~vbeln IN so_vbeln
AND A~audat IN so_audat
AND A~auart IN so_auart
AND A~augru IN so_augru
AND A~faksk IN so_faksp
AND A~vkorg IN so_vkorg
AND A~vtweg IN so_vtweg
AND A~spart IN so_spart
AND A~vkbur IN so_vkbur
AND A~vkgrp IN so_vkgrp
AND A~vsbed IN so_vsbed
AND A~kunnr IN so_kunnr
and B~gbstk IN so_gbstx
AND C~posnr = '000000'.
Thanks
anya
Moderator message: FAQ, it all depends on the content of the so_ ranges at runtime.
Please Read before Posting in the Performance and Tuning Forum
Edited by: Thomas Zloch on Nov 1, 2010 11:57 AMOthers have already responded, and I would only like to dwell on the answers for a short while. Or maybe rather the question.
This question is typical for the inexperienced developer. This particular question is actually a little different, because there is a straight answer: there is no difference. For most questions of this type the answer is "it depends", because one
particular syntax can happen to perform better with one set of data and indexes, but with a different data/index profile another syntax gives better result.
Ideally, as long as two queries are logically equivalent, the syntax should not matter at all, because the optimizer should always figure out the best way to achieve the result. In practice, this is not the case, because there are lots of limitaitons in
an optimizer in an RDBMS.
While it certainly can matter for performance how you write your queries, that is not what you should focus on. What you should focus is to express your query as clearly as possible, and make sure that you have the relevant indexes in place. There is one
rule when it comes to query-writing you should take your heart: never entable a column in a condition in an expression, because that is likely to render index on that column useless.
For this particular question, the answer is that as you long as you write code for SQL Server, use the JOIN syntax. But if you use that in the Oracle world, you may get funny looks from people. It's a different culture over there...
Erland Sommarskog, SQL Server MVP, [email protected]
Maybe you are looking for
-
I have a new Mac mini (2GHz Core 2 Duo) connected to a standard-resolution widescreen Sony TV using the Apple S-video adapter. It only offers me 4:3 ratio resolutions (such as 800x600, 1024x768), whereas if I connect my MacBook Pro using the same ada
-
Acrobat Pro 9 as part of Design Premium
I have Design Premium installed and Acrobat Pro 9 is working perfectly. I would like to deinstall all of the other programs in Design Premium except Acrobat. I only have need for that one program. Has anyone ever done that and if so can you give me a
-
Solution Manager Diagnostics don't display data
Hi, I'm setting up Solution Manager Diagnostics at Solution Manager SP 22. I've installed Wily Introscope Enterpise Manager at Solution Manager Server, and Wily Introscope Agents at Solution Manager and Satellite systems as well. Wily Introscope is w
-
An error occurred during swf generation
Hi I have a spread sheet has quite a lot of formulas in it, eg.. =COUNTIF() =COUNT($H$2:$H$65536)-COUNTIF($H:$H,"<51")-COUNTIF($H$2:$H$65536,">60") =DCOUNTA($A$1:$L$15099,10,M38:N39) =IF(V18=0,0,IF(V18=1,IF(W18=0,0,IF(W18=1,IF(X18=0,0,IF(X18=1,1)))))
-
Client threads block forever in SSLSocketImpl.startHandshake
Hi -- We have an application which has 4 threads polling a webservice over HTTPS every 1-2 minutes. We don't control the server platform or webservice framework. We've encountered a problem where one by one the threads stop polling. This has occurred