我试图执行以下sql查询
function getLargest(array) {
return array
.map(String)
.sort((a, b) => (b + a) - (a + b))
.join('');
}
console.log(getLargest([1, 3, 34, 44, 4, 45, 6, 76, 9, 98, 23]));
console.log([1, 3, 34, 44, 4, 45, 6, 76, 9, 98, 23].sort().reverse().join(''));
由于WHERE条件不起作用,我无法执行此操作,它为我提供了整个表中最大数字的值。
我做错了什么?
答案 0 :(得分:2)
您的查询是否正确
SELECT MAX(amount) AS LargestPrice FROM au_bids WHERE product = 73
查看现场演示
答案 1 :(得分:0)
您的查询是错误的
mysql> select * from Customers;
+-------------+---------------+
| customer_id | customer_name |
+-------------+---------------+
| 1 | Arun |
| 2 | kumar |
| 4 | bbbbb |
| 5 | mmmmm |
| 6 | kkkk |
| 3 | eeeeee |
+-------------+---------------+
6 rows in set (0.00 sec)
mysql> select max(customer_id) from Customers where customer_id=2;
+------------------+
| max(customer_id) |
+------------------+
| 2 |
+------------------+
1 row in set (0.00 sec)