HOWTO? if it exists, increment it, else, insert it

Поиск
Список
Период
Сортировка
От Brian Neu
Тема HOWTO? if it exists, increment it, else, insert it
Дата
Msg-id 280592.60721.qm@web51912.mail.yahoo.com
обсуждение исходный текст
Ответы Re: HOWTO? if it exists, increment it, else, insert it
Список pgsql-novice
I can't seem to get CASE to work for me here and every example that I see is using CASE in a completely different way.

have a table:

    day(default CURRENT_DATE),   user,   count_of_a,    count_of_b

index is ("day", user)


What is the best postgres way to handle updating this table?

I basically need to say,

    if (day,user) exists, then increment count A
    else insert day, user, and count_a = 1.



thank you in advance


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

Предыдущее
От: "Neil Bibbins"
Дата:
Сообщение: Windows 2K Installation difficulties...
Следующее
От: "A. Kretschmer"
Дата:
Сообщение: Re: HOWTO? if it exists, increment it, else, insert it