Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Complex query error
Message
From
02/04/2007 19:43:07
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
01211520
Message ID:
01211532
Views:
21
>I am using a query designer that created this query just for lookup:
>
>
>SELECT Orders.o_orderno, Products.p_productname, Orders.o_orddte,;
>  Orders.o_ordcomp, Orders.o_qty, Orders.o_unitprice, Orders.o_orderedby,;
>  Products.p_warehouseno, Vendors.v_name, Orders.o_checkmark,;
>  Orders.o_v_vendorid, Orders.o_p_productid, Orders.o_orderid,;
>  Orders.o_w_whsid, Whsupv.whs_name, Orders.o_tmp_amt, Orders.o_tmp_qtyrec,;
>  Orders.o_tmp_daterec, SUM(Recdetail.rd_qtyrec);
> FROM ;
>     warehouse!orders ;
>    INNER JOIN warehouse!products ;
>   ON  Orders.o_p_productid = Products.p_productid ;
>    LEFT OUTER JOIN warehouse!recdetail ;
>   ON  Orders.o_orderid = Recdetail.rd_o_orderid ;
>    LEFT OUTER JOIN warehouse!whsupv ;
>   ON  Orders.o_w_whsid = Whsupv.whs_id ;
>    LEFT OUTER JOIN warehouse!vendors ;
>   ON  Orders.o_v_vendorid = Vendors.v_id;
> WHERE  Orders.o_orddte >= ( ?lc_bdate );
>   AND  Orders.o_orddte <= ( ?lc_edate );
> ORDER BY Orders.o_orddte
>
>
>When I go to save I get and error saying "SQL: GROUP BY clause is missing or invalid"
>
>I'm not sure which one to group by. I do have a sum field (Recdetail.rd_qtyrec) in my select fields. I tried a group on Recdetail.rd_qtyrec but it still gave me that error. Any clues as to what I'm doing wrong?
>
>thanks
>Nick

Nick,
You need to group by all non aggregate fields (sum is the aggregate).
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Reply
Map
View

Click here to load this message in the networking platform