Re: Trying to execute several queries involving temp tables in a PHP script

Поиск
Список
Период
Сортировка
От Alexander Farber
Тема Re: Trying to execute several queries involving temp tables in a PHP script
Дата
Msg-id CAADeyWhZbtLCrFXqLzRBGnMX+VH8Pj1WAyKQw14EZHNNFaO1bg@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Trying to execute several queries involving temp tables in a PHP script  (Misa Simic <misa.simic@gmail.com>)
Список pgsql-general
Thank you Misa, the without-temp-tables query has worked flawlessly.


On Wed, Jun 13, 2012 at 5:01 PM, Misa Simic <misa.simic@gmail.com> wrote:
> I think you can have all in one query, without temp tables:
>
>  SELECT r.rid, r.cards, to_char(r.stamp, 'DD.MM.YYYY
> HH24:MI') as day,
>                    c.bid, c.trix, c.pos, c.money, c.last_ip, c.quit,
>                    u.id, u.first_name, u.avatar, u.female, u.city,
> u.vip > CURRENT_DATE as vip
>                    FROM pref_rounds r, pref_cards c, pref_users u
>                    WHERE u.id = c.id and
>                        r.rid = c.rid and
>                        r.rid in (
>
>  select rid
>                    from pref_cards
>                    where stamp > now() - interval '1 day' and
>                    id in (
>  select id
>                    from pref_money
>                    where yw = to_char(current_timestamp - interval '1
> week', 'IYYY-IW')
>                    order by money
>                    desc limit 10
>
> ) and
>                    bid = 'Misere' and
>                    trix > 0
>
>
> )
>                    order by rid, pos;

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

Предыдущее
От: Léa Massiot
Дата:
Сообщение: Starting a cluster as a service
Следующее
От: Philipp Kraus
Дата:
Сообщение: full text index / search