Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 933869
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T20:54:09+00:00 2026-05-15T20:54:09+00:00

Hi my code doesn’t work, Im trying to group my blogentries by year and

  • 0

Hi my code doesn’t work, Im trying to group my blogentries by year and month here’s my sql

SELECT * FROM(
    SELECT WP_BlogEntries.BlogEntryID, WP_BlogEntries.AddedDate,
        WP_BlogEntries.AddedBy, WP_BlogEntries.BlogID, 
        WP_BlogEntries.Title, WP_BlogEntries.Description, WP_BlogEntries.Body,
        WP_BlogEntries.ReleaseDate, WP_BlogEntries.ExpireDate,
        WP_BlogEntries.Approved, WP_BlogEntries.Listed,
        WP_BlogEntries.CommentsEnabled, WP_BlogEntries.OnlyForMembers,
        WP_BlogEntries.ViewCount, WP_BlogEntries.Votes, 
        WP_BlogEntries.TotalRating
    FROM WP_BlogEntries
    WHERE WP_BlogEntries.ReleaseDate < GETDATE()
        AND WP_BlogEntries.ExpireDate > GETDATE()
        AND Approved = 1
        AND Listed = 1
        AND WP_BlogEntries.BlogID = @BlogID) MonthEntries 
    GROUP BY YEAR(ReleaseDate), MONTH(ReleaseDate)
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T20:54:09+00:00Added an answer on May 15, 2026 at 8:54 pm

    It would be helpful to know the error message.

    You can’t do a SELECT * FROM if you specify GROUP BY.

    The only valid columns are those in the GROUP BY or an aggregate function.

    If you group by year and month, then each row will contain one year and month, it is impossible for SQL to know which other columns to display as there could be more than one. (e.g. two blog entries in one month)

    Did you mean to ORDER BY instead?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Given the following code (that doesn't work): while True: # Snip: print out current
My code works great in IE8, Firefox and Safari. But it doesn't work properly
This code doesn't return data from table: var pom = from k in dataContext.student_gods
This code doesn't work jQuery.each([Alloggio,Macchina,Aereo,Treno], function(){ t = this; $(#ChkPrenotazione + t + Default).change(function(){
This code doesn't work as intended, what am I doing wrong? $(document).ready(function(){ $(a.hide-para).click(function(){ $('p').hide();
My code doesn't work right: function rotate(Points, Angle) { for (var i=0; i<Points.length;i++) {
The following code doesn't compile with gcc, but does with Visual Studio: template <typename
Edit: Of course my real code doesn't look exactly like this. I tried to
Any idea why the following code doesn't print the amount of characters in the
I have a colleague who insists that his code doesn't need comments, it's "self

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.