Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SQL statement
Message
 
To
All
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
SQL statement
Environment versions
Visual FoxPro:
VFP 8 SP1
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
Visual FoxPro
Application:
Desktop
Miscellaneous
Thread ID:
01442245
Message ID:
01442245
Views:
84
I have a joined query result set that give the result as show in image #1
	SELECT O_ord_pay.op_main_key, O_ord_pay.op_ord_date, O_ord_pay.op_desc,;
  O_ord_pay.op_vendor, O_ord_pay.op_po_no, O_ord_pay.op_amt, Req_payment.r_payamt, r_paiddate;
 FROM ;
     dbbudget!o_ord_pay ;
    INNER JOIN dbbudget!req_payment ;
   ON  O_ord_pay.op_uniqueid = Req_payment.r_id;
 WHERE  O_ord_pay.op_prt_comp = "P"
how can I rewrite the query above so that my result shows one line showing the total of r_payment (sum) columns. For example
Op_ma        Op_ord_date        Op_desc            Op_vendor       Op_po_no    Op_amt         R_payamt     R_paiddate
7700         05/29/2009         RANGE TARGETS      SPEEDWELL       098252       3761.20       3436.40      10/14/2009
7700         05/29/2009         PRACTICE/DUTY      DOOLEY ENT      098302       33581.32      4786.82      11/19/2009
I would like it to sum R_payment column fo all columns that have the same Op_po_no. I have tried group by but keep getting subscript reference errors. thanks. Nick.
Next
Reply
Map
View

Click here to load this message in the networking platform