You are here: Re: about efficiency(rephrased) « MsSQL Server « IT news, forums, messages
Re: about efficiency(rephrased)

Posted by Ed Murphy on 09/21/06 13:17

yicong wrote:

> could you tell me which case is more efficiency?(my tables have no index)

Add some indexes!

> And does it has any else case more efficiency?

I would write it as follows, for clarity:

select sum(Invoice_Production.Quantity)
from [Invoice_Production]
join [Invoice] on [Invoice].InvoiceNo = [Invoice_Production].InvoiceNo
join [users] on [users].user_id = [invoice].DealerNo
join [dat_Item] on [dat_Item].ItemCode = [Invoice_Production].ItemCode
join [dat_MachineType] on [dat_MachineType].MachineTypeID =
[dat_Item].MachineTypeID
where [Users].User_ID = '"& rs2(0) &"'
and Invoice.Cyear between "&startYear&" and "&endYear&"
and Invoice.Cmonth between "&startMonth&" and "&endMonth&"

Also, you can remove dat_Item and dat_MachineType entirely (unless you
might have null values with non-zero quantities, and want to exclude
those from the total).

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация