Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Query troubles.
Message
From
06/06/2001 11:26:38
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Query troubles.
Miscellaneous
Thread ID:
00515817
Message ID:
00515817
Views:
61
I have a blind spot today. Can't seem to see the forest for the trees and can't come up with the proper SELECT-SQL. I want to create a denormalized temp table to be the basis of a report.

Transactions table has a summary of transactions per day,per countery, per type:
FileDate D
Country C(25)
TCode C(3)
TranCount N(6,0)

I also have a table of all available countries where this product is sold (6 countries only) and a table of possible TCodes (7 records like "DES", "LDS", "PUR", "ANU", "XLD"...)

Not all countries have sales in all Transaction codes (TCode) in all dates. I want to get a join of Transactions with Countries and Tcodes to get NULL entries for all unused Tcodes and unused Countries in the Transactions list for each date.
e.g.:
06/01/01 COLOMBIA DES 4
06/01/01 COLOMBIA LDS 6
06/01/01 PERU     DES 6
06/02/01 BRAZIL   PUR 6
06/02/01 PERU     PUR 3
I want to fill in the missing records to complete all missing codes in each country and all missing countries in each day.

Is there a query or trwo to do this? Or am I better off doin procedural code and SCAN..ENDSCAN to INSERT missing records?

I need the report table denormalized, as opposed to doing a loop when creating the report, and adding missing data, as I will not do the reporting myself but export data to an XLS file for somebody else to deal with.


Alex Feldstein, MCP, Microsoft MVP
VFP Tips: English - Spanish
Website - Blog - Photo Gallery


"Once again, we come to the Holiday Season, a deeply religious time that each of us observes, in his own way, by going to the mall of his choice." -- Dave Barry
Next
Reply
Map
View

Click here to load this message in the networking platform