1 Replies - 429 Views - Last Post: 06 September 2010 - 07:55 AM Rate Topic: -----

#1 megglz  Icon User is offline

  • D.I.C Regular
  • member icon

Reputation: 11
  • View blog
  • Posts: 414
  • Joined: 22-August 08

calling data from last 3 months

Posted 06 September 2010 - 07:45 AM

I have database table with records. The time for each record is stored as 'month year' e.g 'July 2010'. How can I return things from the last 3 months?

I tried something like

select * from data
where time >= DATEADD(MONTH, DATEDIFF(MONTH, 0, CURRENT_TIMESTAMP) - 3, 0)
AND time <  DATEADD(MONTH, DATEDIFF(MONTH, 0, CURRENT_TIMESTAMP), 0);



but it only returns last month.

Any ideas?

Is This A Good Question/Topic? 0
  • +

Replies To: calling data from last 3 months

#2 megglz  Icon User is offline

  • D.I.C Regular
  • member icon

Reputation: 11
  • View blog
  • Posts: 414
  • Joined: 22-August 08

Re: calling data from last 3 months

Posted 06 September 2010 - 07:55 AM

Oh, it actually works. Nevermind :rolleyes:
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1