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 8076211
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T15:12:57+00:00 2026-06-05T15:12:57+00:00

I have a small self made gallery which im still working on it: http://springbreak.enteratenorte.com

  • 0

I have a small self made gallery which im still working on it:
http://springbreak.enteratenorte.com

And the SQL structure is the following:

CREATE TABLE IF NOT EXISTS 'en_albums' (
    'id' int(11) NOT NULL auto_increment,
    'name' text,
    'folder' text,
    'description' text,
    'hits' int(11) default NULL,
    'datecreated' date default NULL,
    PRIMARY KEY  ('id')
 ) ENGINE=MyISAM AUTO_INCREMENT=372 DEFAULT CHARSET=latin1 AUTO_INCREMENT=372 ;

And I have around 300 albums, so I would to sort the most popular which is simple with this query:

SELECT * FROM en_albums ORDER BY hits DESC

But I would like to know how can I do the same thing, but only sort album not older than 6 month, or 1 month, or 1 year, this is a sample of the lines in my albums:

INSERT INTO 'en_albums' 
  ('id', 'name', 'folder', 
   'description', 'hits', 'datecreated') 
VALUES 
 (1, 'Friends Picture', 'en-fotosdeamigos', 
  'Pictures sent by our visitors', 1514, '2005-07-19');

Thanks for the help! 😀

  • 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-06-05T15:12:58+00:00Added an answer on June 5, 2026 at 3:12 pm

    Assuming you only want to get albums created within a time period you can use

    SELECT * FROM en_albums WHERE datecreated > DATE_SUB(NOW(),INTERVAL 6 MONTH) ORDER BY hits DESC 
    

    This will only return items which have a datecreated greater than 6 months ago. You can change the 6 and MONTH part to be what you want. You can replace MONTH with any of the following:

    • MICROSECOND
    • SECOND
    • MINUTE
    • HOUR
    • DAY
    • WEEK
    • MONTH
    • QUARTER
    • YEAR
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a small testview in Silverlight which consists of the following grid: <Grid
I'm working on a small self made blog and I insert new blog items
I have small script in bash, which is generating graphs via gnuplot. Everything works
I think the title is self-explanatory. Many times I have small typos and I
i have small problem understanding why my smart pointer class is leaking on self
I am working on a small iOS project, with a UITableView. I made a
Possible Duplicate: Self-references in object literal declarations Hey Guys, i have a small question
I have a small project that uses libglade and use the following to load
I have a small site which has 200 members. Below is code for the
I am having some issues with a small program I have made that edits

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.