Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Combining two tables
Message
De
27/07/2012 09:59:21
 
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Titre:
Combining two tables
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Windows 7
Network:
Windows 2008 Server
Database:
Visual FoxPro
Application:
Desktop
Divers
Thread ID:
01549418
Message ID:
01549418
Vues:
85
I need some select/SQL advice please

I am combinging two tables T1 & T2 they have customer numbers/Custno and quarter sales totals/qs

T1 contains data for the year 2010 T2 contains data from the year 2011

Data example is something like this;
T1.Custno     T1.QS
001                   $150.00
004                   $650.00
008                   $50.00
012                    $70.00
060                    $95.00

 
T1.Custno     T1.QS
001                   $350.00
002                   $550.00
008                   $750.00
035                    $10.00
060                    $595.00
I want to create a comparison table that includes all the records of both tables, but I want to match up the customers when they are the same.
I know I can do it with a scan/endscan type sort with conditions, but I was wondering if there was an easier way to do it with a select statement.

the resulting table would look like this
Custno               2011_QS            2010_QS
001                   $350.00                    $150.00
002                   $550.00                     $0.00
004                   $0.00                        $650.00                     
008                   $750.00                    $50.00
012                    $0.00                        $70.00
035                    $10.00                       $0.00
060                    $595.00                    $95.00
Thanks....
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform