Re: Weeks elapsed to Months elapsed conversion

Поиск
Список
Период
Сортировка
От Fernando Hevia
Тема Re: Weeks elapsed to Months elapsed conversion
Дата
Msg-id 002501c8c271$4e46e0a0$8f01010a@iptel.com.ar
обсуждение исходный текст
Ответ на Weeks elapsed to Months elapsed conversion  (Allan Kamau <allank@sanbi.ac.za>)
Список pgsql-sql
> 
> Hi all,
> I have a simple question (tried googling but found no 
> answers). How do I convert weeks elapsed into months elapsed?
> I have data that contains duration in weeks (without any 
> other date values such as year and so on) for example a week 
> value of 14 and I would like to convert the 14 weeks to 3 
> months (some lose of accuracy expected).
> Expected tests may be:
> 14 weeks yields 3 months.
> 1 weeks yields 0 months.
> 

If accuracy isnt a issue probably floor() could suite you:

months=select floor(weeks/4);

Regards,
Fernando.



В списке pgsql-sql по дате отправления:

Предыдущее
От: Richard Huxton
Дата:
Сообщение: Re: Weeks elapsed to Months elapsed conversion
Следующее
От: "yazicivo"
Дата:
Сообщение: bcp.exe Fix Triggers