Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: Anders Altberg
  Where is Anders Altberg?
 Uppsala
 Sweden
 Anders Altberg
 To: Michael Landrup
  Where is Michael Landrup?
 
 Vietnam
 Michael Landrup
 Tags
Subject: RE: how to do ?
Thread ID: 188031 Message ID: 188891 # Views: 1 # Ratings: 0
Version: Visual FoxPro 9 Category: Databases, Tables and SQL Server
Date: Tuesday, August 12, 2008 12:48:59 PM         
   


> > The job would be much easier, if you create a third table
> > with fields msdv and hanmuc and leave hanmuc off of hssv.
> >
> > To get the right hanmuc for a record in hssv then would mean
> > you lookup in hsku with the same soku (hsku.soku=hssv.soku)
> > and then lookup the record in the new table with that msdv
> > (hsku.msdv=newtable.msdv) to find newtable.hanmuc as the
> > hanmuc.
> >
> > That way you create the hanmuc once for each msdv and don't
> > need to copy it at all.
> >
> >
> > That you need to copy a value is a sign, that your table
> > design is not normalized.
> >
> > In your table layout, you would need to do these steps as
> > far as I see the relationships:
> >
> > 1.
> > Starting from hssv, you'd scan this and for each record
> > read the soku and hanmuc values.
> >
> > for each of these pairs you do steps2-5:
> >
> > 2.
> > You'd seek the soku value in hsku to lookup the msdv
> > value the soku is connected to.
> >
> > 3.
> > For each msdv found in hsku, the next step is to select all records
> > with that same msdv from hsku.
> >
> > 4.
> > Then the mission is to find soku's still missing in hssv,
> > so for each result found in step 3 you'd need to see if it
> > exists in hssv.
> >
> > 5.
> > From step 4, finding a soku 2222A of msdv 111 is missing in
> > hssv, youd need to add it there with the hanmuc and perhaps
> > also the "ten" you would need to have stored from step 1.
> >
> > I'll leave it to you or someone else to express this with code.
> > I'd rather reorganise tables.
> >
> > Bye, Olaf.
> Hi, Olaf
> Thank for your help!
> you understand my ploblem.
> sorry, If you can, please help me with your code, i'm newbie
> thank

Olaf's first point was "That you need to copy a value is a sign, that your table design is not normalized."

And I agree. Lets start at that point.

-Anders

ENTIRE THREAD

how to do ? Posted by Bac Nguyen Viet @ 8/7/2008 6:33:20 AM
RE: how to do ? Posted by Anders Altberg @ 8/7/2008 3:46:39 PM
RE: how to do ? Posted by Bac Nguyen Viet @ 8/8/2008 3:22:46 AM
RE: how to do ? Posted by Olaf Doschke @ 8/8/2008 12:43:47 PM
RE: how to do ? Posted by Bac Nguyen Viet @ 8/12/2008 5:53:09 AM
RE: how to do ? Posted by Anders Altberg @ 8/12/2008 12:48:59 PM
RE: how to do ? Posted by Anders Altberg @ 8/8/2008 12:51:39 PM