Welcome to TDBSoverflow, Our class's own StackOverflow. Our rules:
  1. Use only meaningful and self-explanatory titles
  2. Tag your questions with meaningful keywords
  3. Use upvotes and downvotes to rate the answers
  4. When you receive a satisfying answer - Click the "V" button
Remember: you may get up to 5 bonus points to your final grade!


+1 vote

in this query

SELECT t.hr_contact 

FROM teams t, hr 

GROUP BY t.desc, hr.id;

what does is mean when we do GROUP BY on attributes which we dont select ??

is it even possible ?

asked Feb 3, 2018 by tikitak (2,970 points)

1 Answer

+1 vote

The real problem here is that t.hr_contact is neither an aggregation nor it is in the GROUP BY clause.

(This might work, and just give you the first result for each group - that's what MySQL does - but it's probably deprecated)

About Grouping by fields not in select - I'm not sure what it's good for, but it will work. To understand what it does, just imagine the fields were in the select, and when the query was over their columns were deleted.

answered Feb 3, 2018 by Assaf (31,090 points)
זה מ2014 מועד ב, הם כתבו את זה בתור שאילתה לכן אני מנסה להבין איך היא בכלל הגיונית ומה היא עושה