Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Full outer join problem
Message
From
22/05/2003 10:55:13
Dan Jackson
Healthier Information
London, United Kingdom
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Title:
Full outer join problem
Miscellaneous
Thread ID:
00791635
Message ID:
00791635
Views:
51
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.
Next
Reply
Map
View

Click here to load this message in the networking platform