Thanks Varden,
 
Yes you are very correct.
I guess I will test with the join.  The concern I had was both tables are
quite large in number of transactions so I was not sure join would work out
to be the best approach but I think yes I should test it out to see. :)
 
Thanks
James
 
  _____  

From: Axapta-Knowledge-Village@yahoogroups.com
[mailto:[EMAIL PROTECTED] On Behalf Of Varden Morris
Sent: 01 November 2007 11:02
To: Axapta-Knowledge-Village@yahoogroups.com
Subject: Re: [Axapta-Knowledge-Village] select firstonly



You can surely save on the number of calls being made to the database by
joining the two tables in the while select instead of separate calls to the
database for the while select followed by another select. If you do not use
the index hint the database will choose an optimum index, provided that
indexes exist and the database is configured to collect and update the
statistics periodically.

Regards,

Varden Morris 

276 Taralake Terrace N.E. 
Calgary, Alberta T3J 0A1 
Canada 

(403) 366-8434 (H) 
(403) 615-1604 (C)
[EMAIL PROTECTED] <mailto:vardenm%40yahoo.com> com



----- Original Message ----
From: James Flavell <[EMAIL PROTECTED] <mailto:djf1994%40gmail.com> com>
To: Axapta-Knowledge- <mailto:Axapta-Knowledge-Village%40yahoogroups.com>
[EMAIL PROTECTED]
Sent: Thursday, November 1, 2007 8:05:29 AM
Subject: [Axapta-Knowledge-Village] select firstonly

Hi again everyone,

Thanks Christoph for the feebdack on index. I have added indexes just to
play safe.

Another query I have is with the firstonly command. I understand basically
how it works but want to know how it really works in practice

Given this code:

while select WMSPallet
order by WMSPalletId
{
select firstonly InventPalletBP
where InventPalletBP. PalletId ==
WMSPallet.wMSPallet Id;

}

Is it better to use firstonly in such a situation?

I mean I am going to be looping through pallets so if I dont use firstonly a
number of inventpalletbp table records will be fetched together which in
theory would be a good thing to save on database calls. But then i am
wondering will the records that are fetched be in any particualr order (e.g.
by palletid) or just from the same page in the SQL server? I guess it
should be read ahead according to the where clause or do I need to
explicitly put an order by or index command against the InventPalletBP
select statement to be sure of this?

Looking forward to your input

Thanks
James

[Non-text portions of this message have been removed]

__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around 
http://mail. <http://mail.yahoo.com> yahoo.com 

[Non-text portions of this message have been removed]



 


[Non-text portions of this message have been removed]

Reply via email to