Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Combining two SQL statements
Message
De
11/06/2002 09:34:58
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00665149
Message ID:
00666890
Vues:
29
Segey:

Whew! I'll try this in the next few days and let you know. Looks daunting!

Yossi

>Try
select NVL(arcash99.invno, arycsh99.invno) AS invno;
>	sum(NVL(arcash99.paidamt,0) + NVL(arycsh99.paidamt,0)) as cashpaid ;
>	from arcash99 ;
>	FULL OUTER JOIN arycsh99 ON arcash99.invno = arycsh99.invno ;
>	where ( ISNULL(arcash99.artype) OR empty(arcash99.artype) ;
>		AND (ISNULL(arycsh99.artype) OR empty(arycsh99.artype)) ;
>	GROUP BY 1 ;
>	INTO CURSOR CURS2
>
>
>>Hi:
>>
>>Is there a way to combine the following into one SQL statement? I tried, but it didn't seem to work.
>>
>>thanks,
>>
>>Yossi
>>
>>
>>select arcash99->invno, ;
>>	sum(arcash99->paidamt) as cashpaid ;
>>	from arcash99 ;
>>	where empty(arcash99.artype) ;
>>	GROUP BY arcash99.invno ;
>>UNION ;
>>	select arycsh99->invno, ;
>>	sum(arycsh99->paidamt) as cashpaid ;
>>	from arycsh99 ;
>>	where empty(arycsh99.artype) ;
>>	GROUP BY arycsh99.invno ;
>>	INTO CURSOR CURS1
>>
>>select CURS1->invno, ;
>>	sum(CURS1->cashpaid) as cashpaid ;
>>	from CURS1 ;
>>	GROUP BY CURS1.invno ;
>>	INTO CURSOR CURS2
>>
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform