database - Multiply values extracted with a select in SQL -


using sql i'd multiply values extracted using select: here example:

select number1, number2 mytable primarykey = myprimarykey 

and result example is: 3, 4.

instead i'd obtain 12.

so it's possible make this?

select number1 * number2 mytable primarykey = myprimarykey 

yeah got it

mysql> show create table numbers\g *************************** 1. row ***************************        table: numbers create table: create table numbers (   'id' int(11) not null,   'num1' int(11) default null,   'num2' int(11) default null,   primary key ('id') ) engine=innodb default charset=latin1 1 row in set (0.00 sec)  mysql> select * numbers; +----+------+------+ | id | num1 | num2 | +----+------+------+ |  0 |    3 |    4 | +----+------+------+ 1 row in set (0.00 sec)  mysql> select num1 * num2 numbers id = 0; +-------------+ | num1 * num2 | +-------------+ |          12 | +-------------+ 1 row in set (0.01 sec) 

Comments

Popular posts from this blog

java - pagination of xlsx file to XSSFworkbook using apache POI -

Unlimited choices in BASH case statement -

apache - How do I stop my index.php being run twice for every user -