ckroon
Posts: 869
|
| Posted: 01/11/2008, 9:07 AM |
|
Hi All.
I can get a the sum of labels in a grid, but I am not sure how to go about getting Sum values directly from the database.
Mysql.
On a grid I have a label that needs to display the running total of donations (field:gift_amt) for a certain donation pledge(field:PID).
So it would be Sum of field:'amt' in table 'pledges' where PID = "pledgeid"//the URL
Any pointers.. samples I can gander at?
_________________
Walter Kempees...you are dearly missed. |
 |
 |
datadoit
|
| Posted: 01/11/2008, 9:18 AM |
|
SQL:
SELECT SUM(amt) AS Amount FROM pledges WHERE PID='{pledgeid}'
or
CCS:
global $YourConnection;
$db = new clsDBYourConnection();
$Component->SetValue(CCDLookUp("SUM(Amt)","pledges","PID='".CCGetParam("pledgeid","")."'",$db));
$db->close();
|
|
|
 |
ckroon
Posts: 869
|
| Posted: 01/11/2008, 9:28 AM |
|
global $awesomeness
$datadoit = super $awesomeness();
_________________
Walter Kempees...you are dearly missed. |
 |
 |
|