473,382 Members | 1,165 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

about Efficiency

I want to select one field from a table,but it should on some conditions
which refer to 5 table ,such as A.FILED1=B.FIELD1 AND B.FIELD2=C.FIELD3 AND
....
Should I use case "select sum(a.amount) from a,b,c,... where
a.field1=b.field1 and b.field2=c.field2 and ..." or "select sum(a.amount)
from select b.field1 from select c.field2 from...."?And which case is more
efficiency?
thanks!

ÎÒÏë¼ÆËãÒ»¸ö±íÖеÄij¸ö×ֶεĺͣ¬µ«´Ë¼Ç¼ÐèÔÚ´Ó¶à¸ö ±íÖвéѯ´Ë¼Ç¼ÊÇ·ñÂú×ãÌض¨µÄÌõ¼þ¡£ÄÇôÎÒÊÇÓÃselect ..from ...where ..and ..and..and ..and ..»¹ÊÇÓÃselect ..from
select ..from select ..from ......£¿ÇëÎÊÊÇÄÄÒ»¸öЧÂʸߣ¿
лл£¡
Sep 20 '06 #1
2 1445
On 20.09.2006 10:51, yicong wrote:
I want to select one field from a table,but it should on some conditions
which refer to 5 table ,such as A.FILED1=B.FIELD1 AND B.FIELD2=C.FIELD3 AND
...
Should I use case "select sum(a.amount) from a,b,c,... where
a.field1=b.field1 and b.field2=c.field2 and ..." or "select sum(a.amount)
from select b.field1 from select c.field2 from...."?And which case is more
efficiency?
I cannot make much sense of this. Please rephrase your question and
especially provide more detail (DDL, DML).

A general remark: if you have two equivalent DML statements you can
easily check with MS tools (Profiler, Query Analyzer) which of the two
is more efficient.

Regards

robert
Sep 20 '06 #2
yicong wrote:
I want to select one field from a table,but it should on some conditions
which refer to 5 table ,such as A.FILED1=B.FIELD1 AND B.FIELD2=C.FIELD3 AND
....
Should I use case "select sum(a.amount) from a,b,c,... where
a.field1=b.field1 and b.field2=c.field2 and ..." or "select sum(a.amount)
from select b.field1 from select c.field2 from...."?And which case is more
efficiency?
select sum(a.amount)
from a
join b on a.field1 = b.field1
join c on b.field2 = c.field2
...
Sep 20 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Steve M | last post by:
1. Near the beginning of the document "Unifying types and classes in Python 2.2" by GvR, which can be found at http://www.python.org/2.2.2/descrintro.html, the author writes the following about...
1
by: Laser Lu | last post by:
Whether it can improve the execution effciency of ASP by centeralizing the often used code into header files and then including these header files in ASP pages? -- Best regards, Laser Lu
10
by: Scotter | last post by:
Please forgive me for reposting; last title didn't quite say it right. I have an ASP application I wrote in vbScript so this is not .Net. There are 20 nearly identical versions of this...
125
by: Sarah Tanembaum | last post by:
Beside its an opensource and supported by community, what's the fundamental differences between PostgreSQL and those high-price commercial database (and some are bloated such as Oracle) from...
7
by: Edward Yang | last post by:
A few days ago I started a thread "I think C# is forcing us to write more (redundant) code" and got many replies (more than what I had expected). But after reading all the replies I think my...
2
by: zhege | last post by:
I am a beginner of C++; I have a question about the std:string and std:cout class; Two pieces of code: -------------------------------- #include <iostream> #include <string> using namespace...
335
by: extrudedaluminiu | last post by:
Hi, Is there any group in the manner of the C++ Boost group that works on the evolution of the C language? Or is there any group that performs an equivalent function? Thanks, -vs
2
by: yicong | last post by:
hi,All could you tell me which case is more efficiency?(my tables have no index) And does it has any else case more efficiency? case1: "select sum(Invoice_Production.Quantity) from...
23
by: TefJlives | last post by:
Hi all, I'm learning a bit about C, and I have a few questions. I'm not trying to insult C or anything with these questions, they're just honestly things I don't get. It seems like pointers...
9
by: OldBirdman | last post by:
Efficiency I've never stumbled on any discussion of efficiency of various methods of coding, although I have found posts on various forums where individuals were concerned with efficiency. I'm...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.