Hi

Interesting problem, normally to get a total by type, you would have a query 
like, 

select van, sum(pay) from ($usertableDaily) group by van;

However you are individually quering each total, your approach is correct, but 
slower.

The problem you have though is the return of

1111 Resource id#3
2222 Resource id#4

So, to begin 

- What version of MySQL
- What OS
- What table type
- Have you checked the table for corruption

I would guess that you have some sort of table corruption. Please try 

repair table ($usertableDaily)

and if that does fix it, email back with the rest of the data.

All the best

Simon

On Saturday 15 February 2003 10:09 am, Guru Geek wrote:
> hello,
>
> I've performed searches on this site and php.net to try and figure out
> why this is occuring.  I can't find any instance in my searches that
> helped me.  So, I'm posting my very first question to this list....
>
> Here's my table ($usertableDaily):
>
> vanNumber|grossPay
> ---------------------
> 1111          | 1000
> 1111          | 500
> 2222          |100
> 2222          |100
>
> Here's my query:
> SELECT SUM(grossPay) FROM $usertableDaily WHERE vanNumber =
> $vanList[$count]
>
> The query appears inside a loop hence the $vanList[$count] variable.  I
> have a txt file that contains the van numbers.  I read that file and
> then run through the loop and for each van number I execute the above
> statement.  Yes, I've trimmed off any extra blank spaces before and
> after the 'read' van numbers...
>
> I want to SUM the grossPay for each van number.  Here's what it should
> be:
> 1111 $1500
> 2222 $200
>
> But when I execute I get this:
> 1111 Resource id#3
> 2222 Resource id#4
>
> Anyone got any idea why this is happening?
>
> Thanks in advance,
> Roger
>
>
>
> ---------------------------------------------------------------------
> Before posting, please check:
>    http://www.mysql.com/manual.php   (the manual)
>    http://lists.mysql.com/           (the list archive)
>
> To request this thread, e-mail <[EMAIL PROTECTED]>
> To unsubscribe, e-mail
> <[EMAIL PROTECTED]> Trouble
> unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

-- 
Simon Windsor
Email: [EMAIL PROTECTED]
Tel: 01454 617689
Mob: 07720 447385


---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to