Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Query troubles.
Message
 
To
06/06/2001 11:26:38
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Miscellaneous
Thread ID:
00515817
Message ID:
00515828
Views:
16
You may want to try something like this:
select table1.key, table2.key;
from table1 
     left outer join table2 on table1.key=table2.key ;
<b>having isnull(table1.key)</b>
Watch out, I think the fact that HAVING is working in a SQL statement without GROUP BY is a bug in VFP. A statement like this will fail in SQL Server or Oracle.

>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.
Hector Correa
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform