My table looks like this:
shiftno sno Amount
100 7 20
8 50
101 9 10
10 30
11 20
I tried with this query
select SUM(Amount)
from example
where shiftNo = (select (max(shiftNo)) from example
It shows result = 10, but actual result is 10 + 30 + 20 = 60. Which was belongs to shiftno=101
How can I get total result of 60?
if you want the highest
shiftNouselimit 1.If you want all
shiftNoand theiramountthen leave thelimitline: