Page 1 of 1

Field operation in sql query

Posted: Sun Mar 14, 2010 1:42 pm
by mariolopes
Hi
I have in my table two fields one named preco_custo and other named preco_venda. Is possible in my sql evaluate the difference between this 2 fields. I need a sal like
$query ="select nome, venda, preco_custo-preco_venda from negocios"
Any ideas?
Thank you

Re: Field operation in sql query

Posted: Sun Mar 14, 2010 2:12 pm
by s.dot
Yes.

$query ="select nome, venda, preco_custo-preco_venda AS `diff` from negocios"

Re: Field operation in sql query

Posted: Sun Mar 14, 2010 2:38 pm
by mariolopes
Thank you
That's what I need