Closed gstamp closed 10 years ago
Hey @gstamp,
There's a bit of text beneath the editor on scuttle.io that describes that count
and other aggregate methods require the column to be fully qualified. Try this:
SELECT ip, COUNT(signin_attempts.ip) FROM signin_attempts
GROUP BY ip ORDER BY COUNT(ip) DESC LIMIT 30
This is a limitation of scuttle-java. If you've got the time to look into fixing the issue, I'd really appreciate a pull request :)
Ah, and now that I read your question again, I realize the second count
isn't being properly handled either. I'll look into it, thanks for the bug report.
Hey @gstamp,
I had some spare time yesterday so I updated scuttle.io with a fix for both these issues. Your SQL now produces the following ActiveRecord/Arel code:
SigninAttempt
.select(:ip, SigninAttempt.arel_table[:ip].count)
.order(SigninAttempt.arel_table[:ip].count)
.reverse_order
.group(:ip)
.limit(30)
Nice one. Thanks for sorting that out.
I noticed when you hit the "Make me Beautiful" button it resets the SQL now. Was that intended?
Hmm that doesn't happen for me... can you provide steps so I can reproduce?
Sorry, I think I made a mistake. On second try it seems to be working fine.
Ok, thanks!
produces