• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Group by clause issue

 
Greenhorn
Posts: 24
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sir I have these codes




When I run this query it says:

not a GROUP BY expression: 'DATA.DocDate' must be in group by clause.: line 23 col 10 (at pos 753)

Please help men what I am doing wrorng?
 
Master Rancher
Posts: 4806
72
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The error message is fairly specific - it points you to the line and location, line 23 col 10, and says that DATA.DocDate must be in a group by clause.  Let's look at line 23 along with the line right before:

Basically the problem is that the expression you're ordering by is different from the expression you're grouping by.  They need to be consistent.  You cant say group by month, ignoring the rest of the date, and then tell it to sort them by date.  You either want

or


(It also looks like you can say either data."DocDate" or just "DocDate" - but I prefer to include the table when possible, and be consistent.)


 
reply
    Bookmark Topic Watch Topic
  • New Topic