GREATEST( prices1.value, prices2.value )
найти максимальную цену между этими id
SELECT MAX( Value ) FROM Prices WHERE ID BETWEEN ID_1 AND ID_2
А как запрос должен выглядеть для нескольких ID_1 и ID_2
SELECT ID_1, ID_2,
( SELECT MAX( Value ) FROM Prices WHERE ID BETWEEN ID_1 AND ID_2 ) AS PriceMax
FROM Range
$s = file_get_contents("fail");
$s = str_replace(["\r","\n"], "", $s);
$s = "[" . str_replace("}{", "},{", $s) . "]";
$array = json_decode($s,1);
/**
* Formats paragraphs around given text for all line breaks
* <br /> added for single line return
* <p> added for double line return
*
* @param string $text Text
* @return string The text with proper <p> and <br /> tags
* @link http://book.cakephp.org/3.0/en/views/helpers/text.html#converting-text-into-paragraphs
*/
public function autoParagraph($text)
{
if (trim($text) !== '') {
$text = preg_replace('|<br[^>]*>\s*<br[^>]*>|i', "\n\n", $text . "\n");
$text = preg_replace("/\n\n+/", "\n\n", str_replace(["\r\n", "\r"], "\n", $text));
$texts = preg_split('/\n\s*\n/', $text, -1, PREG_SPLIT_NO_EMPTY);
$text = '';
foreach ($texts as $txt) {
$text .= '<p>' . nl2br(trim($txt, "\n")) . "</p>\n";
}
$text = preg_replace('|<p>\s*</p>|', '', $text);
}
return $text;
}