Selasa, 19 Februari 2019

Re: [MS_AccessPros] Union Query load very slowly.

 

Dear Duane,

Thanks a  lot. By the way, do I need to add "All" to the first line before only "Select" as well?

Best Regards,

Kevin

On 19-Feb-2019 10:54 PM, Duane Hookom duanehookom@hotmail.com [MS_Access_Professionals] wrote:
 

Hi Kevin,

By default a union query attempts to display only unique records so it has to check all of the returned records for duplicates. If you don't want the "feature" and want your query to run faster try adding " ALL "

.....
UNION ALL SELECT
...

Regards.
Duane


From: MS_Access_Professionals@yahoogroups.com <MS_Access_Professionals@yahoogroups.com> on behalf of Kevin qingqinga@yahoo.com [MS_Access_Professionals] <MS_Access_Professionals@yahoogroups.com>
Sent: Tuesday, February 19, 2019 8:42 AM
To: MS_Access_Professionals@yahoogroups.com
Subject: [MS_AccessPros] Union Query load very slowly.
 
Dear All,

I have a union query behind a unbound subform as below. It takes about
0.5 minutes to load. Is that any way to improve the loading speed?
Thanks in advance.


SELECT
ID,LetterType,TransactionID,TransactionType,OfficeLocation,CostType,Amount,RecordDate,IIf([Checked]=True,"已审核","")
As
CheckAlready,GroupAndRemark,AccountID,ActualTransactionDate,Month(ActualTransactionDate)
As ActualMonth,ELookup("AccountName","tblAccount","AccountID=" &
Nz([AccountID],0)) As Account,Year(ActualTransactionDate) As
ActualYear,FinalAmount FROM qryaTransaction

UNION SELECT
ID,LetterType,ManagerialCostID,TransactionType,OfficeLocation,ManagerialCostType,Amount,RecordDate,IIf([Checked]=True,"已审核","")
As
CheckAlready,Remark,AccountID,ActualTransactionDate,Month(ActualTransactionDate)
As ActualMonth,ELookup("AccountName","tblAccount","AccountID=" &
Nz([AccountID],0)) As Account,Year(ActualTransactionDate) As
ActualYear,FinalAmount FROM qrybManagerialCost

UNION SELECT
ID,LetterType,PromotionCostID,TransactionType,OfficeLocation,PromotionCostType,Amount,RecordedDate,IIf([Checked]=True,"已审核","")
As
CheckAlready,Remark,AccountID,ActualTransactionDate,Month(ActualTransactionDate)
As ActualMonth,ELookup("AccountName","tblAccount","AccountID=" &
Nz([AccountID],0)) As Account,Year(ActualTransactionDate) As
ActualYear,FinalAmount FROM qrycPromotionCost

UNION SELECT
ID,LetterType,OtherIncomeID,TransactionType,OfficeLocation,OtherIncomeType,Amount,RecordDate,IIf([Checked]=True,"已审核","")
As
CheckAlready,Remark,AccountID,ActualOtherIncomeDate,Month(ActualOtherIncomeDate)
As ActualMonth,ELookup("AccountName","tblAccount","AccountID=" &
Nz([AccountID],0)) As Account,Year(ActualOtherIncomeDate) As
ActualYear,FinalAmount FROM qrydOtherIncome

UNION SELECT
ID,LetterType,OtherCostID,TransactionType,OfficeLocation,OtherCostType,Amount,RecordDate,IIf([Checked]=True,"已审核","")
As
CheckAlready,Remark,AccountID,ActualOtherCostDate,Month(ActualOtherCostDate)
As ActualMonth,ELookup("AccountName","tblAccount","AccountID=" &
Nz([AccountID],0)) As Account,Year(ActualOtherCostDate) As
ActualYear,FinalAmount FROM qryeOtherCost
ORDER BY 12, 11;


Best Regards,

Kevin



------------------------------------
Posted by: Kevin <qingqinga@yahoo.com>
------------------------------------


------------------------------------

Yahoo Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/MS_Access_Professionals/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/MS_Access_Professionals/join
    (Yahoo! ID required)

<*> To change settings via email:
    MS_Access_Professionals-digest@yahoogroups.com
    MS_Access_Professionals-fullfeatured@yahoogroups.com

<*> To unsubscribe from this group, send an email to:
    MS_Access_Professionals-unsubscribe@yahoogroups.com

<*> Your use of Yahoo Groups is subject to:
    https://info.yahoo.com/legal/us/yahoo/utos/terms/

__._,_.___

Posted by: Kevin <qingqinga@yahoo.com>
Reply via web post Reply to sender Reply to group Start a New Topic Messages in this topic (3)

Have you tried the highest rated email app?
With 4.5 stars in iTunes, the Yahoo Mail app is the highest rated email app on the market. What are you waiting for? Now you can access all your inboxes (Gmail, Outlook, AOL and more) in one place. Never delete an email again with 1000GB of free cloud storage.


SPONSORED LINKS
.

__,_._,___

Tidak ada komentar:

Posting Komentar