Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Join two unrelated tables together
Message
De
19/01/2013 05:03:51
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Windows 7
Network:
Windows 2003 Server
Database:
Visual FoxPro
Application:
Desktop
Divers
Thread ID:
01563331
Message ID:
01563340
Vues:
49
Hi Robin,

If I understand correctly, I would expand the Logfile DBF to include the necessary fields to indicate whether production was running. Sounds like a simple logical field would do the trick. Of course I am prone to "over engineering a solution, so I would probably add some additional field that would contain data about the production process if it were running. Then you could scan the Logfile file (I'm a very mechanical approach guy) and check each record against the Production log file. I'm assuming that there is date and time data in the Logfile that would allow you to look into the Production Log file to ascertain the appropriate value for the newly added logical field.

Hope this helps,

Ken

>Hi Al
>
>I think it would be best if I explain in at little more detail what I am trying to do:
>
>LOGFILE.DBF contains a log of what has happened to a specific jobno. The form selects all the transactions for a selected job into a list control.
>
>The factory was working 24X7 but then changed to say 8-6 for each day for example.
>
>Now customer now wants the form to show when production wais running and when production was down in the same listbox.
>
>So as you can see the productionlog records don't have a jobno since they are for all jobs.
>
>Looks like I may well be using APPEND FROM to join the two tables together?
>
>Rob
>
>
>
>>>Hi
>>>
>>>I have two tables that I want to join together into a single, problem is they are unrelated to each other, this is to say that one file is transactions for a specific jobno so my code is:
>>>
>>>select upper(cname) as name,type,desc,date,reason,operator,startfinish,transid,JOBNO from wipdata!logfile,operators into cursor tmplog readwrite where jobno=wipdata.jobno and operator=operators.nempno order by transid
>>>
>>>The other file (PRODUCTIONLOG.DBF) is transactions not specific to a jobno but just to a daterange.
>>>
>>>Both files have the same structure but obviously jobno is empty in the PRODUCTIONLOG.DBF
>>>
>>>I'm struggling to work out what the syntax should be to join both tables together since I have no ON clause.
>>>
>>>Any help extremley appreciated
>>
>>If you don't have foreign key values in ProductionLog.dbf then you're stuck. You need to somehow populate the jobno column (if that's the foreign key) so you can do your JOIN.
>>
>>If you know that all transactions in ProductionLog.dbf for a specific range of datetimes is for JobX, then you can UPDATE the JobNo column for the corresponding rows in ProductionLog.DBF (use a copy of the table, to be safer) with JobX's primary key value. But if the transactions are interleaved between several jobs, you can't do that.
>>
>>It sounds like a bunch of child rows in ProductionLog.dbf got created but the code didn't update the foreign key
>>
>>Ask yourself if a human could relate the tables manually. Maybe one couldn't because the information just isn't there. If so, no SELECT - SQL command can magically make it happen.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform