Re: Displaying chat by punished users only to themselves (db fiddle attached)

Поиск
Список
Период
Сортировка
От Alexander Farber
Тема Re: Displaying chat by punished users only to themselves (db fiddle attached)
Дата
Msg-id CAADeyWgv1hmw6J21g7ehtpwvmwCW8_qrLo3v5Dbju20uuW0j5Q@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Displaying chat by punished users only to themselves (db fiddle attached)  (Alexander Farber <alexander.farber@gmail.com>)
Ответы Re: Displaying chat by punished users only to themselves (db fiddle attached)  ("David G. Johnston" <david.g.johnston@gmail.com>)
Список pgsql-general
Is that the right way to do it?


        WITH myself AS (
            SELECT uid
            FROM words_social
            WHERE social = in_social
            AND sid = in_sid
            LIMIT 1
        )
        SELECT
                CASE WHEN c.uid = myself.uid THEN 1 ELSE 0 END,
                c.msg
        FROM    myself
        JOIN    words_chat c ON TRUE
        JOIN    words_games g USING (gid)
        JOIN    words_users opponent ON (opponent.uid IN (g.player1, g.player2) AND opponent.uid <> myself.uid)
        WHERE   c.gid = in_gid
        -- always show myself my own chat messages
        AND     c.uid = myself.uid
        -- otherwise only show messages by not muted opponents
        OR      NOT opponent.muted
        ORDER BY c.created ASC;

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

Предыдущее
От: Francisco Olarte
Дата:
Сообщение: Re: Backing up a DB excluding certain tables
Следующее
От: Francisco Olarte
Дата:
Сообщение: Re: Backing up a DB excluding certain tables