[prog] Another newbie SQL question

Tina tyamar at gmail.com
Thu Apr 29 12:13:47 UTC 2010


Ok, thanks!

On Apr 29, 2010 2:45 AM, "Chris Wilson"
<chris+linuxchix at aptivate.org<chris%2Blinuxchix at aptivate.org>>
wrote:

Hi Tina,


On Wed, 28 Apr 2010, Tina wrote:

> I'm trying to do the following:
>
> SELECT shipcity, shipstate...
I'm not sure you've completely defined what you want to do. E.g. if
shipdate is 2010-01-10 and orderdate is 2010-01-09, is that 0.029xxx or
0.03 or 0.033 or 0 or 1 months between? How would you calculate it? Number
of days (which is well defined) divided by 30?

I think it would be difficult to do even that using completely standard,
portable ANSI SQL. You could use a MySQL extension such as DATEDIFF() and
convert the number of days into a number of months instead.

Cheers, Chris.
--
Aptivate | http://www.aptivate.org | Phone: +44 1223 760887
The Humanitarian Centre, Fenner's, Gresham Road, Cambridge CB1 2ES

Aptivate is a not-for-profit company registered in England and Wales
with company number 04980791.


More information about the Programming mailing list