Win a copy of Murach's Java Programming this week in the Beginning Java forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

select sum(columnName) from TableName groupby columnName , get same result without using groupby  RSS feed

 
Lalit Sahu
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
able Name:emp


Question: how i can get same result without using group by.
 
Dave Tolls
Ranch Hand
Posts: 2721
30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why don't you want to use GROUP BY?
That's part of its job.
 
Lalit Sahu
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dave Tolls wrote:Why don't you want to use GROUP BY?
That's part of its job.


interviewer asked me above question
 
Dave Tolls
Ranch Hand
Posts: 2721
30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My response would be "why would you want to"?

You can do it in the SELECT clause itself, but it looks really messy.
Oh, and a DISTINCT on the Designation column.
 
I've got no option but to sell you all for scientific experiments. Or a tiny ad:
Thoughts on deprecation in Java
https://coderanch.com/t/683016/java/Deprecation-Java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!