Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Full outer join problem
Message
De
22/05/2003 10:55:13
Dan Jackson
Healthier Information
London, Royaume Uni
 
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Titre:
Full outer join problem
Divers
Thread ID:
00791635
Message ID:
00791635
Vues:
50
Hi all,

I can't get an SQL query to work properly, & am hoping that the SQL experts among you may be able to help.

I have 2 tables:
-'Agesex'- a 'lookup' table for age/sex groups, eg:
Agegp Sex
00-04 0
00-04 1
05-14 0
05-14 1

- 'Tmp3' - a table of the number of patients (cnt) GP's (gpcode) have of each age/sex group, eg:

Gpcode Agegp Sex Cnt
00001 00-04 0 204
00001 00-04 1 180
00001 05-14 0 79
00001 05-14 1 96

What I'd like is to outer join the tables so that the full 'Agesex' table is reproduced for every Gpcode, even when a GP has no patients of a particular age/sex group. I've tried the following without luck, so any help appreciated.

SELECT t.*, a.agegp as aagegp, a.sex as asex from agesex a FULL OUTER JOIN tmp3 t ON a.agegp=t.agegp AND a.sex=t.sex INTO TABLE tmp5 DATABASE raw ORDER BY gpcode, a.agegp, a.sex

TIA.
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform