Re: Q on "Re: [SQL] select is fast, update based on same where clause is slow "

2001-09-21 Thread Josh Berkus
Bladvin, > I understand why did Jeff's original solution not work. I understand > why yours do. > > But could you please explain me how the 74000^2 can be calculated > for this original query?: Sure. In Jeff's original query, the updated instance of the table (sessions2) and the referenced ins

Re: [SQL] select is fast, update based on same where clause is slow

2001-09-21 Thread Jeff Barrett
That did the trick. Thank you for the quick detailed answer. It runs in about a minute now. Jeff Barrett "Stephan Szabo" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > On Fri, 21 Sep 2001, Jeff Barrett wrote: > > > I have a select statement that returns a set

Re: [SQL] Selecting latest value II

2001-09-21 Thread Thurstan R. McDougle
Hi back Carl van Tast wrote: > > Hi, Thurstan > > On Thu, 20 Sep 2001 17:30:46 +0100, "Thurstan R. McDougle" > <[EMAIL PROTECTED]> wrote: > > > [...] > >Carl van Tast had 2 good methods as follows > > > >SELECT userid, val > >FROM tbl > >WHERE NOT EXISTS (SELECT * FROM tbl AS t2 > >

Re: [SQL] select is fast, update based on same where clause is slow

2001-09-21 Thread Josh Berkus
Jeff, I think that you're running into a syntactical problem here: > Then I issue an update as follows (to update those 74,000+ rows): > update sessions2 set sinceinception = 0 > from sessions2 s, (select min(datetime) as datetime, membid from > sessions2 > group by membid) as mindate > where s.

Re: [SQL] select is fast, update based on same where clause is slow

2001-09-21 Thread Stephan Szabo
On Fri, 21 Sep 2001, Jeff Barrett wrote: > I have a select statement that returns a set of 74,000+ results back in > under a minute as follows: > > select s.sessid, s.membid, s.datetime > from sessions2 s, (select min(datetime) as datetime, membid > from sessions2 >

[SQL] select is fast, update based on same where clause is slow

2001-09-21 Thread Jeff Barrett
I have a select statement that returns a set of 74,000+ results back in under a minute as follows: select s.sessid, s.membid, s.datetime from sessions2 s, (select min(datetime) as datetime, membid from sessions2 where membid is not null