• 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
  • Ron McLeod
  • Rob Spoor
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Henry Wong
  • Liutauras Vilda
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Tim Holloway
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Mikalai Zaikin
  • Piet Souris

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: 4024
53
  • 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.)


 
I don't like that guy. The tiny ad agrees with me.
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
reply
    Bookmark Topic Watch Topic
  • New Topic