ID | Date | Status | Physician ID
44397479 10/13/2009 17:40 NOSHOW
44397480 10/13/2009 16:40 CHECKED OUT 108
44397481 10/13/2009 14:32 CHECKED OUT 108
44397482 10/14/2009 10:44 RESCHEDULED 108
44397483 8/26/2009 12:35 RESCHEDULED ...
select sum(value) as 'Value',max(value)
from table_name where sum(value)=max(sum(value)) group by id_name;
The error is: Invalid use of group function (ErrorNr. 1111)
Any idea?
Thanks.
...
Using SQL Server 2005. I am building an inventory/purchasing program and I’m at the point where I need the user to “check out” equipment. When he selects a product, I need to query which stock locations have the available Qty, and tell the user which location to walk to/ retrieve product.
Here is a query for a particular [StockLocation_...
how to translate this piece of C code into Python >=2.6 ?
unsigned long memSum(unsigned char *p, unsigned long len)
{
unsigned long i, sum=0;
for(i=0; i<len; i++)
sum = sum + *p++;
return sum;
}
of course
f=open("file_to_sum",'rb')
m = f.read()
f.close()
sum( array.array('B', m) )
does not work
...
Suppose we have a table T with two fields A and B, both decimal.
How would I wite an L2S query that produces this T-SQL ?
SELECT SUM(T.A), SUM(T.B)
FROM T
The idea is NOT to pull in all the records and do a sum in memory...
...
Ok, so here's my problem... and I'll preface this by saying that I'm pretty well-versed in Excel; however, I've very little knowledge about the INDIRECT function (so if it's something obvious with the INDIRECT function, please excuse my newb-ness).
I'm trying to make my Compliance Worksheet a bit more efficient. I have a list of contro...
Hello All,
I'm currently working with a paradox database that was implemented before I started working at my current job at an insurance firm.
Long story short is that when I am trying to to compile a query of the debit/credit balances of all the active clients, it gives me a different balance per client if I do a query for each indivi...
I simply need to sum the value of about 15 columns (say, 20-35) in codeigniter.
What's the best way to do this?
...
I'm trying to add up two multidimensional arrays, both equally sized, field by field. I.e.:
$sum[4][3] = $a[4][3] + $b[4][3];
Or:
$a = array( array(1, 4), array(3, 2));
$b = array( array(9, 2), array(1, 0));
Should result in:
$sum = array( array(10, 6), array(4, 2));
Is there a more elegant way than foreaching over all the array...
I'm using the following statement and getting almost everything I need. In addition, I'd like to get the SUM of all of the row_total results.
SELECT c.id AS campaign_id, c.amount AS campaign_amount, c.warning_trigger,
COUNT(cc.id) as code_count, DATEDIFF(c.end_date, CURDATE()) as days_remain,
SUM(c.amount) as row_total
FROM campaign...
I'm doing a "select sum(foo) from bar" query on a MySQL database that's summing up 7.3mm records and taking about 22 seconds per run. Is there a trick to speeding up sums in MySQL?
...
I have a MySQL query that returns a single row that is a series of 1s and 0s. It's for a progress bar indicator. I have the summing of it in code now, but I tried to sum the values in a query, and realized I couldn't use SUM(), because they're many columns but just one row.
Is there a way I can sum this automatically in the query? It's...
I have two tables
user_raters:
| id(int) | to_id(int) | value(int) | created_at(datetime)
|1 | 2 | 1 | 2009-03-01 00:00:00
EDIT: I changed the user_rater_id. history_user_raters.user_rater_id is related to user_raters.id
history_user_raters:
| id(int) | user_rater_id(int) | value(int) | created_at(datetime...
This is what i have so far in the SQL code........
SELECT DISTINCTROW [OEE/A Query].Press,
Sum([OEE/A Query].[SumOfLabor Hours]) AS [Sum Of SumOfLabor Hours],
Sum([OEE/A Query].[SumOfGood Pieces]) AS [Sum Of SumOfGood Pieces],
Sum([OEE/A Query].[Scrap Pieces]) AS [SumOfScrap Pieces],
Sum([OEE/A Query].[SumOfMachine Hours]) AS [SumOf...
From this code below....
SELECT DISTINCTROW Sum([Shift Report Table].Straighten) AS SumOfStraighten, Sum([Shift Report Table].Shine) AS SumOfShine, Sum([Shift Report Table].Standardize) AS SumOfStandardize, Sum([Shift Report Table].Sustain) AS SumOfSustain, Sum([Shift Report Table].Sort) AS SumOfSort, [Shift Report Table].Press, [Shift ...
How do you calculate with code the SUM of a row of data instead of a column of data?
...
The output that comes from a custom view of mine is as follows...
Col1 Col2 Col3 Col4
xxxx Cake 1 1*
Cake xxxx 2* 1
xxxx Cake 2 0*
xxxx Cake 0 0*
Cake xxxx 2* 0
Cake xxxx 2* 0
and what i would like to sum is...
For every row,
if the word Cake is found in Col1, t...
Hi all,
Could someone double check my SQL statement for proper operation and general commonsense approach?
Here's what's going on: I have a parent and child table with a one-to-many relationship, joined on a column named AccountNumberKey. The child table has numeric columns in it I need to sum up.
The data is such that all child r...
Hello,
I have the following three tables in a MySQL database in order to give ratings to comments of users:
Users:
id name
-----------
1 Smith
2 Brown
Comments:
id user_id post_id comment
-----------------------------------
1 2 1 Test 1
2 1 1 Test 2
3 1 1 ...
Hi,
Can someone help me out with the following Linq statement? I'm trying to get join 4 tables through Linq, group by the last table and sum a property of the first.
var payments = (
from payment in db.Payments
join payees in db.cmsMembers on payment.PayeeID equals payees.nodeId
join paye...