Answer the question
In order to leave comments, you need to log in
How to display the cheapest among all by condition in SQL?
For example, there is a price_items table:
id | make_name | cost |
---|---|---|
one | TOYOTA | 350 |
2 | TOYOTA | 100 |
3 | FIAT | 210 |
4 | TOYOTA | 190 |
SELECT p2.cost FROM price_items AS p1 INNER JOIN price_items AS p2 ON p1.make_name = p2.make_name WHERE p1.id = 1
ORDER BY p2.cost
, doesn't work because instead of pulling out one row, it pulls out all rows with TOYOTA brands. Answer the question
In order to leave comments, you need to log in
SELECT cost FROM price_items WHERE name = (SELECT name FROM price_items WHERE id = 1)
ORDER BY cost LIMIT 1;
Try like this
$re = '/\bООО\b/u';
$str = 'ООО ОООрогакопат "ООО рогопыт" рОООга "Компания ООО"';
echo preg_replace($re, '', $str);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question