Cast

Поиск
Список
Период
Сортировка
От Eduardo Vázquez Rodríguez
Тема Cast
Дата
Msg-id 413F79B6.1030907@insys-corp.com.mx
обсуждение исходный текст
Ответы Re: Cast  (Gaetano Mendola <mendola@bigfoot.com>)
Список pgsql-novice
I made I mistake choosing the data types in my database I try to run  a
query that look like this
Duration data type is varchar

SELECT name, SUM(duration) AS total
FROM table
GROUP BY name
HAVING  name != 'John'

I get the following error:
ERROR:  function sum(character varying) does not exist
HINT:  No function matches the given name and argument types. You may
need to add explicit type casts.

1. How can I made a cast on the query from varchar to int?

2. If I change the datatype on the database from varchar to int, do I
loose all the data on that field?

Thanks in advanced

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

Предыдущее
От: Ron St-Pierre
Дата:
Сообщение: Re: I NEED HELP!!! - (ERROR: parser: unterminated quoted
Следующее
От: Gaetano Mendola
Дата:
Сообщение: Re: Cast