Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Help with SQL
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Titre:
Divers
Thread ID:
00004043
Message ID:
00004087
Vues:
25
>Help, I am a rank SQL beginner...
>
>I am trying to produce a ledger summary report. I have a lookup table that includes some descriptive text, a budget amount, and a budget code. I want to produce a table that is like this with a field for amount spent. The amount spent should come from a check table, linked on the budget code. But, those budget codes that have not been used don't show up. I need those to show though. What am I doing wrong?
>
>Here is what I have so far...
>select lkacode.account, description, aie_code, budget, sum(achecks.amount);
> from g:\artfox\aie\lkacode, g:\artfox\aie\achecks;
> where lkacode.account = achecks.account;
> and lkacode.aie_code = achecks.itemcode;
> into table f:\artfox\aledsumm


Mike is right! An outer join is the ticket to the show! But since Fox SQL is not 100% SQL compliant, U must write an SQL routine which uses the UNION clause.

select A.account, A.description, A.aie_code, ;
A.budget, sum(B.amount) as Calc_Amt ;
from g:\artfox\aie\lkacode A, g:\artfox\aie\achecks B; 0
Steve Medvid
Systems Analyst

Environmental Resource Management
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform