Welcome to Help4Web.co.uk - Web Design Help, Html Tutorial, Php, Asp , SQL help and CCNA, MCSE definitions!
Google
Webkpop-web.com

     Main Menu

· Home
· Free Downloads
· Computing FAQ
· Contact Us
· Free Software Downloads
· Tech Forum
· Technology News
· Web Design Help
· Web Links
· Your Online Account
· Your PM



     Web Browser


     Website Links
Supermediastore! #1 in Computer media & Accessory

White Papers IT
Learn Korean
Chinese Pop Music
Advertise Kpop
Korean Pop Site Map
Web Design
Pop Music
Chinese Girls
HK Pop Korean Music
Lee Hyori
Hyori
Boa Park Ji Yoon
Baby Vox YG Family
Jeon Ji Hyun
1 Tym Ha Ji Won
Shyne Rain Bi
Shin Mina SM Town
Fly to the Sky
Korean Girls and Models
Nicholas Tse
161 Clan
보아
Edison Chen
Sung Hi Lee
Shinhwa
Andy Lau Jay Chou
White Papers
Case Study SES
Kelly Chen
Liu Yi Fei Sammi Cheng
Jordan Chan Music
Computer Jobs IT

Computer Help Forum and Programming Advice :: View topic - Help needed
 Forum FAQForum FAQ   SearchSearch   UsergroupsUsergroups   ProfileProfile   Log inLog in 

Help needed

 
Post new topic   Reply to topic    Computer Help Forum and Programming Advice Forum Index -> SQL and Databases
View previous topic :: View next topic  
Author Message
nomuken
Web Design Newbie
Web Design Newbie


Joined: Oct 18, 2005
Posts: 17

PostPosted: Wed Jan 25, 2006 2:19 am    Post subject: Help needed Reply with quote

Hello Friends,

I am having a report in my application, where i need to display a customer report which has various criaterias on it.

Query seems to take too much time for execution.
There are few reasons i can find out...
1. There are more than 18,000 customers
2. 20,000 customer address where i need to have left join
3. 10,000 document records where i need to have left join
and some functions like SUM, DISTINCT, CONCAT_WS, etc...


I have prepared a query as :

SELECT DISTINCT customers.ROWID, CONCAT_WS( " ", customers.salutation, customers.firstname, customers.lastname ) AS customername, customers_address.cstreet, CONCAT_WS( " ", customers_address.czip, customers_address.clocation ) AS customerziplocation, customers_address.ccountry, customers_address.ccompany AS customercompany, sum(
IF (
documents.totalAmount IS NULL , 0, documents.totalAmount
) ) AS totamount

FROM customers

LEFT JOIN documents ON ( documents.custID = customers.ROWID AND documents.docType = 'Invoice' AND documents.numbered = '1' AND documents.status <> 'replace' )

LEFT JOIN selcriterias_customer ON ( selcriterias_customer.customerID = customers.ROWID )

LEFT JOIN customers_address ON ( customers_address.customerID = customers.ROWID AND customers_address.addressType = 'Private' )

INNER JOIN users ON ( users.ROWID = customers.createdBy )

WHERE customers.isdeleted =0 AND customers.mandateID =1
GROUP BY customers.ROWID
HAVING sum(
IF (
documents.totalAmount IS NULL , 0, documents.totalAmount
) ) >= '1200' AND sum(
IF (
documents.totalAmount IS NULL , 0, documents.totalAmount
) ) <= '12001'

I doubt is there anything doing with lot's of left joins for performace?
what i can have to optimize the speed?
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Computer Help Forum and Programming Advice Forum Index -> SQL and Databases All times are GMT + 10 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum







Learn Chinese | Learn cantonese | Learn Mandarin | Grace Park | Party Organisers | Kaila yu | Phone Card | Twins | Chinese Society | Loans UK | BokuMaro | CV Help Book | Chinese Wife | Korean Singles | British Born Chinese | Bae Yong Jun | Speak Korean | Chinese Models | Music | Information Security Management | Maritime Greenwich Campus | Covering Letters Help | Chinese Music | Jang Nara | SES | YG Family | Learn Korean | Firewall Definition | Server Definition | Wireless Network Definition | E-Commerce Definition | Sales Leads | Application Firewall | CCNA definitions | Research Papers | Webcast | CV Help

Author KPop Music :- Jon Bock ( Chinese Pop Music Learn Korean )
Produced by Kpop-Web Design Associates, all rights not reserved.
Internet Marketing and Search Engine Optimisation Software Defined Radio