Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Combining three tables into one cursor
Message
From
23/12/2005 10:05:44
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Title:
Combining three tables into one cursor
Environment versions
Visual FoxPro:
VFP 8 SP1
OS:
Windows XP SP2
Miscellaneous
Thread ID:
01080505
Message ID:
01080505
Views:
50
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
Next
Reply
Map
View

Click here to load this message in the networking platform