| От | Jean-Luc Lachance |
|---|---|
| Тема | Re: type conversion? |
| Дата | |
| Msg-id | 3CB32A0D.D02958A6@nsd.ca обсуждение |
| Ответ на | type conversion? (Peter Atkins <Peter.Atkins@nextcard.com>) |
| Список | pgsql-sql |
Try: SELECT SUM(int4(total_hours)) AS hours FROM my_table WHERE flag='$flag'; JLL Peter Atkins wrote: > > All, > > I have a column "total_hours | character varying(5) " and I am unable to > perform the aggrigate function SUM() because of the column type. > Without changing the type is there a way to convert the datatype by using > CAST(), to_char() or something simular? So that I may calculate the SUM(). > > SELECT SUM(total_hours) AS hours FROM my_table WHERE flag='$flag'; > > Thanks! > -p > > ---------------------------(end of broadcast)--------------------------- > TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org
В списке pgsql-sql по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера