You are here: Re: Help needed with DATETIME Arithmetic « MsSQL Server « IT news, forums, messages
Re: Help needed with DATETIME Arithmetic

Posted by Mintyman on 09/20/06 13:28

Thanks for the reply. That seems to have done the trick :o)

"ZeldorBlat" <zeldorblat@gmail.com> wrote in message
news:1158695486.220267.171700@m73g2000cwd.googlegroups.com...
>
> Mintyman wrote:
>> Hi,
>>
>> I have the following query:
>>
>> SELECT dbo._Fault.id, dbo._Fault.date_created, dbo._Fault.reference,
>> dbo._Fault.class, dbo._Fault.owner, dbo._Fault.Contact_Name, dbo._Fault.
>> Product,
>> dbo._Fault.Problem_Description,
>> dbo._Fault.Action_Taken, dbo._Fault.Problem_Solution,
>> dbo._Fault.Duration_start_date, dbo._Fault.Duration_duration,
>> dbo._Fault.Duration_date_summary,
>> dbo._Fault.Fault_Status, dbo._Fault.Fault_Source, dbo._Fault.Part_Number,
>> dbo._Fault.Serial_No,
>> dbo._Product.id AS PRODUCTID,
>> dbo._Product.description
>> FROM dbo._Fault LEFT OUTER JOIN
>> dbo._Product ON dbo._Fault. Product =
>> dbo._Product.id
>>
>> I need an additional field appended to the end of this (called
>> 'DATECOMPLETED') that will take the 'Duration_start_date' and add the
>> 'Duration_duration' to it - effectively giving me a new datetime field
>> that
>> is newer than the start date.
>>
>> I have tried unseccessfully to amend the code but I am afraid my
>> knowledge
>> of SQL is limited. I would greatly appreciate if someone could show me
>> how
>> to do this.
>>
>> Thanks,
>>
>> Darren
>
> If Duration_duration is a number and you want it to be the number of
> days added to Duration_start_date you would add something like this to
> the select list:
>
> dateadd(dd, Duration_duration, Duration_start__date)
>

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация