'Calculate the Price High and Low MySql query results
Is there any can figure out on how to query the below image as a sample result,
What I want is to calculate the Price from yesterday compare to the price today order by date, if the price higher than yesterday then calculate the difference vise versa.
CREATE TABLE `pricing` (
`prc_price` int(11) NOT NULL,
`pdo_price` int(11) NOT NULL,
`date_entry` date NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_bin;
--
-- Dumping data for table `pricing`
--
INSERT INTO `pricing` (`prc_price`, `pdo_price`, `date_entry`) VALUES
(100, 100, '2022-04-01'),
(200, 200, '2022-04-02'),
(150, 100, '2022-04-03'),
(200, 100, '2022-04-04'),
(200, 250, '2022-04-05'),
(150, 150, '2022-04-06');
COMMIT;
Here SQLfiddle http://sqlfiddle.com/#!9/27f796f/1/0
This is the Sample Result
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|

