If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > MySQL > MySQL data substraction

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 09-15-08, 07:42
sushma007 sushma007 is offline
Registered User
 
Join Date: Aug 2007
Posts: 64
Thumbs down MySQL data substraction

Is it possible to substract the entire date parameters(year,month,date) by using a single or two functions .
Reply With Quote
  #2 (permalink)  
Old 09-15-08, 08:26
r937 r937 is offline
SQL Consultant
 
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,525
yes, it is

if you would give a more realistic example, i can give a more realistic answer
__________________
r937.com | rudy.ca
please visit Simply SQL and buy my book
Reply With Quote
  #3 (permalink)  
Old 09-15-08, 11:11
sushma007 sushma007 is offline
Registered User
 
Join Date: Aug 2007
Posts: 64
Suppose i have two date columns say 'DATE1' and 'DATE2' which has values "2008-09-15" and "2007-07-11" .

now i want the diff of these two columns in date format, i mean the diff should return a date value.
Reply With Quote
  #4 (permalink)  
Old 09-15-08, 11:20
r937 r937 is offline
SQL Consultant
 
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,525
oh really? and what is the "date value" that you would like to see from this particular calculation?
__________________
r937.com | rudy.ca
please visit Simply SQL and buy my book
Reply With Quote
  #5 (permalink)  
Old 09-15-08, 11:20
gvee gvee is offline
www.gvee.co.uk
 
Join Date: Jan 2007
Location: UK
Posts: 10,156
Find the difference in days, and then add this on to the base date (equivalent to 0)?
__________________
George
Twitter | Blog
Reply With Quote
  #6 (permalink)  
Old 09-15-08, 14:19
healdem healdem is offline
Jaded Developer
 
Join Date: Nov 2004
Location: out on a limb
Posts: 9,250
The manual should be your friend
__________________
I'd rather be riding my Versys or my Tiger 800 let alone the Norton
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On