Jump to content

how to Multiplying query for mysql

- - - - -

  • Please log in to reply
2 replies to this topic

#1
lol33d

lol33d

    Programmer

  • Members
  • PipPipPipPip
  • 149 posts
hi guys

this is my table:

CREATE TABLE IF NOT EXISTS `multiplying` (

  `id` int(11) NOT NULL AUTO_INCREMENT,

  `price` float NOT NULL,

  PRIMARY KEY (`id`)

) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=6 ;


--

-- Dumping data for table `multiplying`

--


INSERT INTO `multiplying` (`id`, `price`) VALUES

(1, 250),

(2, 5),

(3, 3),

(4, 1),

(5, 4.5);

so my numbers is: 250, 5, 3, 1, 4.5

for sum all numbers: 250 + 5 + 3 + 1 + 4.5
i use this query:

SELECT SUM(`price`) FROM `multiplying`


how to Multiplying all numbers?

Multiplying: 250 * 5 * 3 * 1 * 4.5



thank you so much

#2
Gerg? Magyar

Gerg? Magyar

    Newbie

  • Members
  • PipPip
  • 22 posts

[COLOR="#0000FF"]SELECT[/COLOR] [COLOR="#0000FF"]EXP[/COLOR]([COLOR="#0000FF"]SUM[/COLOR]([COLOR="#0000FF"]LOG[/COLOR](`price`))) [COLOR="#0000FF"]FROM[/COLOR] `multiplying`



#3
lol33d

lol33d

    Programmer

  • Members
  • PipPipPipPip
  • 149 posts
nice, thank you




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users