2 baskets of oranges with 7 and 10 each
3 baskets of peaches with 12 and 15 each
然后我想设置:
for every orange basket value of maxfruit to 10 and
for every peach basket value of maxfruit to 15
我试图
update baskets set maxfruit = (select max(fruitCount) from baskets b where b.fruit = fruit)
,但它只是所有设置到15 ...
试试这个是否正常:更新篮子设置maxfruit =(从篮子b中选择max(fruitCount)b where b.fruit = fruit)其中basket.fruit ='fruit' – SGventra
整点就是不使用特定名称:( – Zeks
then您必须在插入数据时将maxfruit值设置为最大值。 – SGventra