Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
SQL view with enginbehavior 80 ?
Message
 
 
À
09/04/2003 06:20:02
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00775399
Message ID:
00775436
Vues:
8
>how can I make the following view work in vfp8 without setting engonbehavior to 70?
>
>create sql view vInvoice as ;
>Select ;
>	A.invoice_ID,  ;
>	INT(A.billing_ID) AS billing_ID,  ;
>	INT(A.site_ID) AS site_ID,  ;
>	PADR(A.invoicenum,10) as invoicenum,;
>	PADR(A.billrefno,20)  as billrefno ;
>	A.isedi,  ;
>	A.invdate,  ;
>	A.datezero,;
>	A.arnotes,  ;
>	A.autopay,  ;
>	A.invtype,;
>	A.sbill_ID,  ;
>	A.issbill,  ;
>	A.insuser_ID,;
>	A.upduser_ID, ;
>	A.insdttm, ;
>	A.upddttm,;
>	A.busgrp_ID,;
>		B.arcode,;
>		B.grpcode,;
>		B.inco, ;
>		B.name1,;
>		B.name2, ;
>		B.addr1,;
>		B.addr2, ;
>		B.city, ;
>		B.state,;
>		B.zip,;
>		B.country,;
>		B.isedi210,;
>		B.isinvprint,;
>			0000000.00 + Sum(Iif(C.xntype = 'CHARGE' And C.p3_ID = A.billing_ID,;
>			ROUND(C.rate*C.qty+C.addamt,2),0000000.00)) As OrigAmt,;
>			0000000.00 + Sum(Iif(C.xntype = 'CHARGE',Round(C.rate*C.qty+C.addamt,2),  -1*Round(C.rate*C.qty+C.addamt,2))) As Balance ;
>	FROM Invoice A  ;
>		JOIN Sites B On A.site_ID = B.site_ID   ;
>	JOIN FinXn C On A.invoice_ID = C.p2_ID  And C.isgl  
And C.datepost <= Date()  And (C.xntype = 'CHARGE'  
 Or C.xntype = 'RECEIPT'   Or C.xntype = 'ADJUST')   ;
>		GROUP By 1
>
>
>Thanks
>
>
Hi Peter,

There're a couple ways to get this view to work:
1. You can include all non-aggregate fields in GROUP BY. It'll work if the values are the same in the column for each group.
2. You can wrap those fields in MIN() or MAX()
--sb--
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform