[SGVLUG] Can SQL even do this?

Solomon K. Chang skevin521 at yahoo.com
Wed Oct 29 00:51:56 PDT 2008


Well, that's MySQL-specific.  Thom hasn't yet said what flavor of SQL he's using.

Personally, as someone who's had to do plenty of weekly date calcs from SQL syntax, yes, date_add and date_sub are your friends.  When you need to render DATE data types into a humanly readable format, use date_format.

As someone who claims to be the premier MySQL guru of Southern California, I'll take on your problem in full stride.  Send me the structure of your tables and a description of what you're trying to do...


Solomon Chang


--- On Tue, 10/28/08, Alan Horn <ahorn at deorth.org> wrote:
From: Alan Horn <ahorn at deorth.org>
Subject: Re: [SGVLUG] Can SQL even do this?
To: "SGVLUG Discussion List." <sgvlug at sgvlug.net>
Date: Tuesday, October 28, 2008, 8:37 PM

On Tue, 28 Oct 2008, John E. Kreznar wrote:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> "Emerson, Tom \(*IC\)"
<Tom.Emerson at wbconsultant.com> writes:
>
>> I've got an "interesting" problem -- ... I'm not
even sure how to
>> convert "11/02/2008 + 3" to get "11/16/2008" ...
>

A quick net search turns up this :
http://www.devshed.com/c/a/MySQL/Date-Arithmetic-With-MySQL/3/

mysql has the DATE_ADD and DATE_SUB functions.

They do what you would expect.

Cheers,

Al




      
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.sgvlug.net/pipermail/sgvlug/attachments/20081029/c2320d5e/attachment.html 


More information about the SGVLUG mailing list