Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Combining three tables into one cursor
Message
De
23/12/2005 10:05:44
 
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Titre:
Combining three tables into one cursor
Versions des environnements
Visual FoxPro:
VFP 8 SP1
OS:
Windows XP SP2
Divers
Thread ID:
01080505
Message ID:
01080505
Vues:
51
Hi all.
I am dabbling into SQL syntax. I have three tables:
Orders (OrderNum, Company, Item, Quantity, OrderDate, Current, Class)
OrderHist (OrderNum, Company, Item, Quantity, OrderDate, Current, Class)
ItemSpec (Item, Weight, CaseWeight, Color, ID)

I am trying to create a cursor:
a_tmpf (Company, OrderNum, OrderDate, Item, Color, Quantity, CaseWeight)

Table Structures of Orders and OrderHistory are identical to one another. If an order exists in OrderHistory and also in Orders, Orders.Current = "X". OrderHIstory.Current = ""
SELECT ItemSpec
SET ORDER TO item
SELECT OrderHist
SET RELATION TO item INTO ItemSpec
SELECT OrderHist
SET ORDER TO Company

SELECT OrderHist.OrderNum, OrderHist.item, OrderHist.Quantity, OrderHist.Company ,;
          OrderHist.OrderDate, ItemSpec.color, ItemSpec.weight, ItemSpec.CaseWeight ;
     FROM OrderHist INNER JOIN ItemSpec ON OrderHist.item = ItemSpec.item ;
     WHERE OrderHist.Company = thisform.lccustno ;
          AND BETWEEN(OrderHist.OrderDate,thisform.ldbdate,thisform.ldedate) ;
	 AND OrderHist.Class <> "###" AND ItemSpec.ID == "B";
     INTO CURSOR a_tmpf
I am now wondering if I can (somehow) add Orders records to the SELECT?

Or, do I need to write the entire code again, refering to Orders.dbf this time?

If I need to provide more information, let me know.
Thanks,

Chad
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform