using group by clause in subquery in sql
Check your (), they are not at right places. Should be something more like this:
select w.userID,count(w.id)
from (select id,max(bidAmount),userID from Bids group by id, userID) w
group by w.userID
Try this:
select userID,count(id)
from (
select id,max(bidAmount),userID from Bids group by id,userID
) as tmp
group by userID
You can use group by
in a subquery, but your syntax is off.
select userID,count(id)
from
(
select id,max(bidAmount),userID
from Bids
group by id,userID
)
GROUP BY userid