Skip site navigation (1) Skip section navigation (2)

Re: SELECT ... WHERE ... IN (SELECT ...) ->

From: Sergey Suleymanov <solt(at)eatpbank(dot)ru>
To: Russian PostgreSQL community <pgsql-ru-general(at)postgresql(dot)org>
Subject: Re: SELECT ... WHERE ... IN (SELECT ...) ->
Date: 2006-12-05 08:10:49
Message-ID: 87k616zrsm.fsf@su.eatpbank.ru (view raw or flat)
Thread:
Lists: pgsql-ru-general
>>>>> Anton  writes:

 >> А если таки явно нарисовать join ?
 Anton> то ничего не меняется, т.к. оно как раз это вроде бы само-то и
 Anton> делает.

        Тогда остается только разнести order by от join

select collect_time
  from (select collect_time 
          from n_logins 
               join n_traffic on (n_traffic.login_id = n_logins.login_id and 
                                  n_traffic.collect_time > '1970-01-01 00:00:00')
          where n_logins.account_id = '1655' ) as q
  order by collect_time limit 1

и индекс по (login_id,collect_time)


-- 
  Sergey Suleymanov

In response to

pgsql-ru-general by date

Next:From: AntonDate: 2006-12-05 09:34:00
Subject: Re: SELECT ... WHERE ... IN (SELECT ...) -> SELECT ... WHERE (... OR ... )
Previous:From: AntonDate: 2006-12-05 08:07:29
Subject: Re: SELECT ... WHERE ... IN (SELECT ...) ->

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group