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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T02:32:58+00:00 2026-05-14T02:32:58+00:00

My table is like this on Postgres, note that all days start by 01,

  • 0

My table is like this on Postgres, note that all days start by 01, there is only 1 entry a month+year

SELECT * FROM "fis_historico_receita" 
+----+------------+---------------+
| id | data       | receita_bruta |
+----+------------+---------------+
| 1  | 2010-02-01 | 100000.0      |
| 2  | 2010-01-01 | 100000.0      |
| 3  | 2009-12-01 | 100000.0      |
| 4  | 2009-11-01 | 100000.0      |
| 5  | 2009-10-01 | 100000.0      |
| 6  | 2009-09-01 | 100000.0      |
| 7  | 2009-08-01 | 100000.0      |
| 8  | 2009-07-01 | 100000.0      |
| 9  | 2009-06-01 | 100000.0      |
| 10 | 2009-05-01 | 100000.0      |
| 11 | 2009-04-01 | 100000.0      |
| 12 | 2009-03-01 | 100000.0      |
| 13 | 2009-02-01 | 100000.0      |
| 14 | 2009-01-01 | 100000.0      |
| 15 | 2008-12-01 | 100000.0      |
+----+------------+---------------+

What I want is to find 12 months starting right from before the current.

I tried this:

select *
from fis_historico_receita
where data in interval '1 year'

I really would like an answer using Interval, +1 goes for everyone that runs on Postgres

  • 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-14T02:32:58+00:00Added an answer on May 14, 2026 at 2:32 am

    Try this:

    select *
    from fis_historico_receita
    where data BETWEEN NOW() - interval '1 year' AND NOW()
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a postgres table like this: CREATE SEQUENCE seq; CREATE TABLE tbl (id
I'm using Postgres and I'm trying to write a query like this: select count(*)
Imagine I have table like this: id:Product:shop_id 1:Basketball:41 2:Football:41 3:Rocket:45 4:Car:86 5:Plane:86 Now, this
If I have a table like this: CREATE TABLE sizes ( name ENUM('small', 'medium',
I have a table like this: <table> <tfoot> <tr><td>footer</td></tr> </tfoot> <tbody> <tr><td>Body 1</td></tr> <tr><td>Body
I have a table like this (Oracle, 10) Account Bookdate Amount 1 20080101 100
I have a database table like this: id version_id field1 field2 1 1 texta
I have a table like this: Application,Program,UsedObject It can have data like this: A,P1,ZZ
I have a HTML table like this: <table border=1> <tbody> <tr> <td><a href=# class=delete>DELETE
I have a Table like this one: |UserId | ContactID | ContactName --------------------------------------- |

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.