Table (showing only relevant columns)
ID | product_name | stock | stock_level
6 | test name | 5 | 4
7 | test name 2 | 3 | 9
I have a lot more rows in my database.
In MYSQL, how can I get every row where the stock value is less than the stock_level value?
Like this?
SELECT * FROM table WHERE stock < stock_level
That would return row2 (stock = 3, stock_level= 9) but not row1 (stock = 5, stock_level= 4).
<?php
$result = mysqli_query($myslqi, "SELECT * FROM table WHERE stock < stock_level")) {
....
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.