• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Rob Spoor
  • Henry Wong
  • Liutauras Vilda
Saloon Keepers:
  • Tim Moores
  • Carey Brown
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
Bartenders:
  • Frits Walraven
  • Himai Minh
  • Jj Roberts

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: 3827
50
  • 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.)


 
When all four tires fall off your canoe, how many tiny ads does it take to build a doghouse?
SKIP - a book about connecting industrious people with elderly land owners
https://coderanch.com/t/skip-book
reply
    Bookmark Topic Watch Topic
  • New Topic