Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SQL help to combine two tables
Message
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00531538
Message ID:
00531925
Views:
9
Hi, Brenda!
SELECT DIST cust_id1, cust_id2 FROM tCredit ;
UNION ;
SELECT cust_id1, cust_id2 FROM tDebit ;
INTO CURSOR tmp
Then you can use OUTER JOINs with tCredit and tDebit tables.

>I have two tables: tCredit and tDebit. Each has three fields: cust_id1, cust_id2, amt. Want to produce a table that has cust_id1, cust_id2, credit_amt, debit_amt.
>There are cust_id1/cust_id2 records in tCredit that are not tDebit and visa versa. So they would have 0 in the non-matching amount field.
>I tried a FULL OUTER JOIN but could not get the cust_id1/cust_id2 to have a value for both the tCredit and tDebit non-matches.
Previous
Reply
Map
View

Click here to load this message in the networking platform