Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SQL Select in SQL Server
Message
 
 
To
14/06/2004 16:01:18
General information
Forum:
Visual FoxPro
Category:
Client/server
Miscellaneous
Thread ID:
00913605
Message ID:
00913652
Views:
14
Hi João,

You select is invalid even in VFP8 because it includes fiedls that are neither in GROUP BY clause nor are aggregate functions. What records values for thouse fields do you expect to come from? You can first get sum per matirial and than use it as derived table in join to whatever table you need.
SELECT b.material, SUM(b.Quantidade) as QUANT;
	FROM FICCARC a ;
	LEFT OUTER JOIN FICCARL b ;
	ON a.encomenda = b.encomenda ;
	LEFT OUTER JOIN FICMOLDE c ;
	ON a.terceiro = val(c.molde) ;
	WHERE a.encomenda=VAL(thisform.ncarga) ;
	GROUP BY b.Material ;
>Hi all ,
>
>How can i convert this SQL statement to work with SQL Server,
>
>
>SELECT * , SUM(b.Quantidade) as QUANT;
>	FROM FICCARC a ;
>	LEFT OUTER JOIN FICCARL b ;
>	ON a.encomenda = b.encomenda ;
>	LEFT OUTER JOIN FICMOLDE c ;
>	ON a.terceiro = val(c.molde) ;
>	WHERE a.encomenda=VAL(thisform.ncarga) ;
>	GROUP BY b.Material ;
>
>
>Error:
>is invalid in the select list because it is not contained in either an aggregate function or the GROUP BY clause.

>If a put in the select one date field and in group the same field the sum is done by DATE and not by all records.
>
>
--sb--
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform