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