RE: Problem with SQL Statement

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



You can also write it this way.
 SELECT materialMaster.Rate,
sum(materialMaster.'QTY') as TOT,
(sum(materialMaster.'QTY')*2) as TOT2  FROM 
materialMaster WHERE QTY>=10

Hope that helps.

Jon
--- TechLDS <tech@xxxxxxxxxxxxxxxxxxxxxxxxxx> wrote:

> Have you tried using a variable?
>
http://dev.mysql.com/doc/refman/5.0/en/variables.html
> 
> 
> -----Original Message-----
> From: php-objects@xxxxxxxxxxxxxxx
> [mailto:php-objects@xxxxxxxxxxxxxxx] On
> Behalf Of Zaid, Shaikh
> Sent: Saturday, January 14, 2006 12:56 AM
> To: php-objects@xxxxxxxxxxxxxxx
> Subject:  Problem with SQL Statement
> 
> How to execute a sql query which sums up a field on
> a criteria and then
> doubles the value.
>    
>   i.e.   
>    
>   Field code = materialMaster
>   Values      =   1, 2, 3, 4...and so on
>    
>    
>   SELECT materialMaster.Rate,
> sum(materialMaster.'QTY') as TOT FROM
> materialMaster WHERE QTY>=10
>    
>   the above sql statement is working fine but i m
> not getting the solution
> to double the value i mean i need twice of TOT. I
> cannot store tot and then
> double the value i need it within the sql statement
> as a field code.
>    
>    
>   Zaid
>    
> 
> 		
> ---------------------------------
> Yahoo! Photos - Showcase holiday pictures in
> hardcover  Photo Books. You
> design it and we'll bind it!
> 
> [Non-text portions of this message have been
> removed]
> 
> 
> 
> PHP Data object relational mapping generator
> http://www.metastorage.net/
> Yahoo! Groups Links
> 
> 
> 
>  
> 
> 
> 
> 
> 
> 
> 
> 


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 


PHP Data object relational mapping generator
http://www.metastorage.net/ 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/php-objects/

<*> To unsubscribe from this group, send an email to:
    php-objects-unsubscribe@xxxxxxxxxxxxxxx

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 




[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Soap]     [Kernel Newbies]     [Yosemite]     [Yosemite Campsites]

  Powered by Linux