473,395 Members | 2,006 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Previous MONTHNAME

Hey all,
I have a query that pulls data based on the month. I'm using
MONTHNAME(CURDATE()) to get the current month. I need to get the
previous month. Is there a way to do this using MONTHNAME?
thanks in advance
Jul 23 '05 #1
1 3500
"Wharfrat" <wh********@comcast.net> wrote in message
news:As********************@comcast.com...
Hey all,
I have a query that pulls data based on the month. I'm using
MONTHNAME(CURDATE()) to get the current month. I need to get the
previous month. Is there a way to do this using MONTHNAME?
thanks in advance


No! You don't use MONTHNAME() to calculate what the previous month was. To
do that you want to subtract a month from the current month is. The month
before this one can always be determined by:

SELECT DATE_ADD(CURDATE(), INTERVAL -1 MONTH)

And if you want to see it as a name instead of a number you can enclose that
calculation with MONTHNAME() :

SELECT MONTHNAME(DATE_ADD(CURDATE(), INTERVAL -1 MONTH))

Thomas Bartkus
Jul 23 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Marcel | last post by:
Hello, I'm working on a search application for my website. The website contains a lot of pictures, and a search should return clickable thumbnails. No problems there. My problem started when I...
9
by: eddie wang | last post by:
How to convert a month to previous month in a very easy way? For example, I have AUGUST, but I want JULY to return. Thanks. *** Sent via Developersdex http://www.developersdex.com *** Don't...
1
by: Andy Wells | last post by:
I'm using VB.NET and I have an application that binds a schema to the main form's controls, and the user has the ability to load an XML file through the schema and into the bound form. My...
4
by: Abraham Andres Luna | last post by:
how can i use the DateAndTime module in my csharp code i included a using statement: using Microsoft.VisualBasic; and then called the function: DateAndTime.MonthName(1);
4
by: Bob | last post by:
I cut and pasted the following from the HELP into the form load event of a new form and I get an error stating that MonthName is a namespace and can not be used as shown. What's wrong? Dim...
24
by: Ian Rastall | last post by:
I do a site where I have a previous and next link at the bottom of every page. It looks like: <p><a href="foo01.html">Previous</a> | <a href="foo03.html">Next</a></p> Seeing as they're always...
1
by: roveagh1 | last post by:
Hi I've been using the 2 year old link below to repeat values from previous record field into current corresponding field. It's worked fine for text but the last piece of advice was to use the same...
2
by: TB | last post by:
HI, is there a formula(function) you could use to the display the previous month's name in a report. i know there is a function(formula) that returns the previous month's value (ie 4 for the...
3
by: ITAutobot25 | last post by:
Now this is really the last problem (for real now) with this assignment. My sorter is not working. I managed to sort by product name in my previous assignment; however, I can't get it to work on this...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.