Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SQL Statment!!!
Message
From
04/03/2000 12:01:41
 
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Title:
Miscellaneous
Thread ID:
00341645
Message ID:
00341683
Views:
21
>select table1.*, space(x) as BBal from table1 ;
> union select table2.*, space(x) as ABal from table2 ;
> into cursor c_result
>

Actually, unless an instance of a value for Date only appeared in either Table1 or in Table2, never in both, you need a Full Outer Join, followed by a reduction to merge the two dates (one of which might otherwise be null)
SELECT Table1.Date AS DateA, ABal, Table2.Date AS DateB, BBal ;
   FROM Table1 ;
   FULL OUTER JOIN Table2 ON Table1.Date = Table2.Date ;
   INTO CURSOR (SYS(2015))
lcAlias = ALIAS()
SELECT IIF(ISNULL(DateA), DateB, DateA) AS Date, ABal, BBal ;
   FROM (lcAlias) ;
   INTO CURSOR c_result
USE IN (lcAlias)
You could have the option of using IIF(ISNULL()) or NVL() constructs to strip nulls from ABal and BBal in c_result if you couldn't deal with nulls or wanted to see specific values where nulls were found.
EMail: EdR@edrauh.com
"See, the sun is going down..."
"No, the horizon is moving up!"
- Firesign Theater


NT and Win2K FAQ .. cWashington WSH/ADSI/WMI site
MS WSH site ........... WSH FAQ Site
Wrox Press .............. Win32 Scripting Journal
eSolutions Services, LLC

The Surgeon General has determined that prolonged exposure to the Windows Script Host may be addictive to laboratory mice and codemonkeys
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform