473,320 Members | 2,110 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,320 software developers and data experts.

User Variable and DATE_ADD Function

Hi,

I have a query that uses a user variable to get the latest date from a
table using the MAX function. I then need to add 1 month onto this
date using DATE_ADD but the query just returns a NULL for the second
field.

Here's my query:

SELECT
CheckId,
#This displays correctly
@lastchecked:=MAX(CheckedDate),

#This just returns (NULL)
DATE_ADD(@lastchecked,INTERVAL 1 MONTH ) as lastcheckedplus1month
FROM
checkingtable
GROUP BY
CheckId

Has anyone managed to use DATE_ADD with a user variable? Can you tell
me if I'm missing something?

Any help is greatly appreciated.

Thank you,

Peter.

Feb 9 '07 #1
0 3731

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

Similar topics

13
by: perplexed | last post by:
How do you convert a user inputted date to a unix timestamp before insterting it into your database? I have a form, with a textfield for a date that the user inputs in the format mm-dd-yyyy and...
1
by: Bob Bedford | last post by:
Hi, I'm trying this query: insert into logpay(datetime,ip,typepay,idannounce) values(DATE_ADD(NOW(),INTERVAL 14 DAYS),'255.255.255.255',2,178) I want to add 14 days from now in datetime field. ...
0
by: mailing | last post by:
hi, it's possible in mysql set the db folder into home user? example: user fred, home is /home/fred i want store db data in /home/fred/db. it's possible? i've tested in /home/fred/.my.cnf...
1
by: windandwaves | last post by:
Hi Folk Some of you may be interested in a function that allows you to add/substract from a date in PHP, using a MySql Dateformat (e.g. 2005-10-31) (NOT TESTED): Any comments appreciated. ...
2
by: paul meaney | last post by:
All, myself and another developer have been staring blankly at a screen for the past 48 hours and are wondering just what stunningly obvious thing we are missing. We are trying to load up 2...
10
by: sqlboy2000 | last post by:
Hello all, I have something very simple going on here and I'm scratching my head as to what the problem is. There are 4 items in my project, 2 webforms, a user control, and a module: ...
0
by: joseph conrad | last post by:
Hi, I tried to implement my own session handler in order to keep control on the process the drawback I foun it is not creating and storing in my cookie the PHPSESSID variable anymore. reading te...
13
JodiPhillips
by: JodiPhillips | last post by:
G'day, I have a silly and simple problem that I need some guidance with. Due to the way our network is set up, I am unable to use the group permissions for Access and have had to implement log...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

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.