[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.axapta.programming

3 level join not working (Optimization question

michael

12/8/2005 11:48:00 PM

Hi

I am doing some optimization and I can't quite get it to work and I was
therefore wondering if there where any sql experts here because I am doing
something wrong.

Original code:
--------------------------------------------
prodTable = prodTable::find(_prodId) ;

while select BOM
index hint BOMId
where BOM.BOMId == prodTable.BOMId
{
if (BOM.inventTable().ItemType() == ItemTypeBase::Recipe)
{
itemId += BOM.ItemId ;
}

}
--------------------------------------------
Obviously this is not the best way to do it so I have tried to do it all in
one sql call.

This is what I am trying to do to optimize it:

select firstonly ItemId
from BOM
index hint BOMId
group by ItemId, BOMId
join ProdTable
group by BOMId, ProdId
where ProdTable.BOMId == BOM.BOMId &&
ProdTable.ProdId == _prodId
join InventTable
group by ItemId, cbgItemType
where inventTable.ItemId == ProdTable.ItemId &&
inventTable.ItemType == ItemTypeBase::Recipe;

--------------------------------------------
But this is not working. I could split it up in a couple of calls instead of
one, which would be faster than the old code, but I would like to get it to
work in one call since this a called a lot of times and therefore needs to be
very effective

Anybody have any ideas what I am doing wrong?

Thanks,
Michael


4 Answers

rheu

12/9/2005 9:31:00 AM

0

Hi Michael,

In your original code your checking the item type of the item from the BOM
table, in your optimized code your checking the item type of the ProdTable,
which is not the same.
I'm also wondering whether your should use ProdBOM table instead of BOM table.

Regards,

Rob


"Michael" wrote:

> Hi
>
> I am doing some optimization and I can't quite get it to work and I was
> therefore wondering if there where any sql experts here because I am doing
> something wrong.
>
> Original code:
> --------------------------------------------
> prodTable = prodTable::find(_prodId) ;
>
> while select BOM
> index hint BOMId
> where BOM.BOMId == prodTable.BOMId
> {
> if (BOM.inventTable().ItemType() == ItemTypeBase::Recipe)
> {
> itemId += BOM.ItemId ;
> }
>
> }
> --------------------------------------------
> Obviously this is not the best way to do it so I have tried to do it all in
> one sql call.
>
> This is what I am trying to do to optimize it:
>
> select firstonly ItemId
> from BOM
> index hint BOMId
> group by ItemId, BOMId
> join ProdTable
> group by BOMId, ProdId
> where ProdTable.BOMId == BOM.BOMId &&
> ProdTable.ProdId == _prodId
> join InventTable
> group by ItemId, cbgItemType
> where inventTable.ItemId == ProdTable.ItemId &&
> inventTable.ItemType == ItemTypeBase::Recipe;
>
> --------------------------------------------
> But this is not working. I could split it up in a couple of calls instead of
> one, which would be faster than the old code, but I would like to get it to
> work in one call since this a called a lot of times and therefore needs to be
> very effective
>
> Anybody have any ideas what I am doing wrong?
>
> Thanks,
> Michael
>
>

michael

12/9/2005 6:32:00 PM

0

Hi Rob

Thanks for the help. I didn't even notice that I took the wrong one. I
thought the reason it didn't work was because I was using group by's wrong or
something.

But thanks for the help, it works now

Michael

"rheu" wrote:

> Hi Michael,
>
> In your original code your checking the item type of the item from the BOM
> table, in your optimized code your checking the item type of the ProdTable,
> which is not the same.
> I'm also wondering whether your should use ProdBOM table instead of BOM table.
>
> Regards,
>
> Rob
>
>
> "Michael" wrote:
>
> > Hi
> >
> > I am doing some optimization and I can't quite get it to work and I was
> > therefore wondering if there where any sql experts here because I am doing
> > something wrong.
> >
> > Original code:
> > --------------------------------------------
> > prodTable = prodTable::find(_prodId) ;
> >
> > while select BOM
> > index hint BOMId
> > where BOM.BOMId == prodTable.BOMId
> > {
> > if (BOM.inventTable().ItemType() == ItemTypeBase::Recipe)
> > {
> > itemId += BOM.ItemId ;
> > }
> >
> > }
> > --------------------------------------------
> > Obviously this is not the best way to do it so I have tried to do it all in
> > one sql call.
> >
> > This is what I am trying to do to optimize it:
> >
> > select firstonly ItemId
> > from BOM
> > index hint BOMId
> > group by ItemId, BOMId
> > join ProdTable
> > group by BOMId, ProdId
> > where ProdTable.BOMId == BOM.BOMId &&
> > ProdTable.ProdId == _prodId
> > join InventTable
> > group by ItemId, cbgItemType
> > where inventTable.ItemId == ProdTable.ItemId &&
> > inventTable.ItemType == ItemTypeBase::Recipe;
> >
> > --------------------------------------------
> > But this is not working. I could split it up in a couple of calls instead of
> > one, which would be faster than the old code, but I would like to get it to
> > work in one call since this a called a lot of times and therefore needs to be
> > very effective
> >
> > Anybody have any ideas what I am doing wrong?
> >
> > Thanks,
> > Michael
> >
> >

Benway (original non-Zionist)

12/12/2010 1:16:00 PM

0



Benway (original non-Zionist) wrote:
> Benway (original non-Zionist) wrote:
> > Benway (original non-Zionist) wrote:
> > > Bipartisan quisling politicians really pulled a
> > > fast one on dopy Aussie voters with plague
> > > immigration, third world urban consolidation,
> > > imported scab labour and cultural diversity. The
> > > victims are burdened with the costs - of course.
> > > In China, things got so bad with overpopulation
> > > that the government intervened to enforce single
> > > child families. Catholics and other religious
> > > groups really need to get a clue. God did not
> > > order any of this mass-breeding overpopulation
> > > mayhem. Globalist politicians and media drones
> > > insist that nations must abolish themselves for a
> > > mirage of global government. But a government's
> > > first duty is to its own citizens, and it has no
> > > mandate to dissolve the nation against the wishes
> > > of the people.
> > >
> > > ------------------------------
> > >
> > > Peter Nolan - Kangaroo court Australia at work: Nut Case:-
> > >
> > > http://peternolanpsychopath.blogspot.com/2010/09/narcissistic-personality-disord...
> >
> > ***************************************
> >
> > Masochistic Aussie slaves must understand that
> > governments are forcing a population growth policy
> > on Australians. I don't want bulk immigration, I
> > don't want Australia converted into a third world
> > pesthole. Those who argue for brute-force
> > immigration seem to be lunatics, dullards, or
> > sleazebags after quick money. Bloodsucking
> > impulses of property parasites are always
> > supercharged when quisling governments set up
> > plague immigration Ponzi schemes. Exploit the
> > workers, grab their money, export manufacturing
> > industries and import scab labour to destroy the
> > jobs.
> >
> > ----------------------------
> >
> > Peter Nolan - Kangaroo court Australia at work: Nut Case:-
> >
> > http://peternolanpsychopath.blogspot.com/2010/09/narcissistic-personality-disord...
> >
> > ****************************************
>
> Peter Nolan - Kangaroo court Australia at work: Nut Case:-
>
> http://peternolanpsychopath.blogspot.com/2010/09/narcissistic-personality-disord...
>
> He who is his own lawyer has a fool for a client.
>
> **********************************************

Globalism is the economics of treason, while
cultural diversity is an intellectual poison put
about by mass immigrationists and ABC mass media
cock-gobblers. Most Aussies are psychologically
incapable of seeing through globalist mass media
drones. Incessant mass immigration is a variant of
the Shock Doctrine. I think we should regard
pandemic immigration as a variant of the other
truly insidious tools of disaster capitalism. I
believe we will see social violence breakout at
many levels soon. There will be crime against
property and people, especially where the sense of
community was deliberately eroded by the treason
of plague immigration and cultural diversity.

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

Peter Nolan - Kangaroo court Australia at work: Nut Case:-

http://peternolanpsychopath.blogspot.com/2010/09/narcissistic-personality-disord...

He who is his own lawyer has a fool for a client.

***********************************

Benway (original non-Zionist)

12/12/2010 3:08:00 PM

0



Benway (original non-Zionist) wrote:
> Benway (original non-Zionist) wrote:
> > Benway (original non-Zionist) wrote:
> > > Benway (original non-Zionist) wrote:
> > > > Bipartisan quisling politicians really pulled a
> > > > fast one on dopy Aussie voters with plague
> > > > immigration, third world urban consolidation,
> > > > imported scab labour and cultural diversity. The
> > > > victims are burdened with the costs - of course.
> > > > In China, things got so bad with overpopulation
> > > > that the government intervened to enforce single
> > > > child families. Catholics and other religious
> > > > groups really need to get a clue. God did not
> > > > order any of this mass-breeding overpopulation
> > > > mayhem. Globalist politicians and media drones
> > > > insist that nations must abolish themselves for a
> > > > mirage of global government. But a government's
> > > > first duty is to its own citizens, and it has no
> > > > mandate to dissolve the nation against the wishes
> > > > of the people.
> > > >
> > > > ------------------------------
> > > >
> > > > Peter Nolan - Kangaroo court Australia at work: Nut Case:-
> > > >
> > > > http://peternolanpsychopath.blogspot.com/2010/09/narcissistic-personality-disord...
> > >
> > > ***************************************
> > >
> > > Masochistic Aussie slaves must understand that
> > > governments are forcing a population growth policy
> > > on Australians. I don't want bulk immigration, I
> > > don't want Australia converted into a third world
> > > pesthole. Those who argue for brute-force
> > > immigration seem to be lunatics, dullards, or
> > > sleazebags after quick money. Bloodsucking
> > > impulses of property parasites are always
> > > supercharged when quisling governments set up
> > > plague immigration Ponzi schemes. Exploit the
> > > workers, grab their money, export manufacturing
> > > industries and import scab labour to destroy the
> > > jobs.
> > >
> > > ----------------------------
> > >
> > > Peter Nolan - Kangaroo court Australia at work: Nut Case:-
> > >
> > > http://peternolanpsychopath.blogspot.com/2010/09/narcissistic-personality-disord...
> > >
> > > ****************************************
> >
> > Peter Nolan - Kangaroo court Australia at work: Nut Case:-
> >
> > http://peternolanpsychopath.blogspot.com/2010/09/narcissistic-personality-disord...
> >
> > He who is his own lawyer has a fool for a client.
> >
> > **********************************************
>
> Globalism is the economics of treason, while
> cultural diversity is an intellectual poison put
> about by mass immigrationists and ABC mass media
> cock-gobblers. Most Aussies are psychologically
> incapable of seeing through globalist mass media
> drones. Incessant mass immigration is a variant of
> the Shock Doctrine. I think we should regard
> pandemic immigration as a variant of the other
> truly insidious tools of disaster capitalism. I
> believe we will see social violence breakout at
> many levels soon. There will be crime against
> property and people, especially where the sense of
> community was deliberately eroded by the treason
> of plague immigration and cultural diversity.
>
> ------------------------
>
> Peter Nolan - Kangaroo court Australia at work: Nut Case:-
>
> http://peternolanpsychopath.blogspot.com/2010/09/narcissistic-personality-disord...
>
> He who is his own lawyer has a fool for a client.
>
> ***********************************

Even though population growth is identified as the
cause of most material problems facing people,
eliminating the cause is rarely mentioned as a
solution! Here is a global disease that
governments and media drones don't want to cure.
Australia produced about $37 billion worth of food
in 2008 and imported about $5 billion worth. So we
consume $18 billion worth of food. At this rate we
will become a nett importer of food before long.
In a country already struggling with its carrying
capacity and social harmony, to denigrate critics
of toxic immigration is condescending and
bullying.

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

Peter Nolan - Kangaroo court Australia at work: Nut Case:-

http://peternolanpsychopath.blogspot.com/2010/09/narcissistic-personality-disord...

He who is his own lawyer has a fool for a client.

************************************