Re: Confusion over query stratergy

2008-10-17 Thread Ian Christian
2008/10/17 Brent Baisley <[EMAIL PROTECTED]>: > Why are you creating a subquery/derived table? > > Just change your limit to 1,2 > ORDER BY updates.AcctSessionTime DESC LIMIT 1,2 Because then the maths in the select part isn't executed, and I don't get the figures I need. -- MySQL General Maili

Re: Confusion over query stratergy

2008-10-17 Thread Brent Baisley
Why are you creating a subquery/derived table? Just change your limit to 1,2 ORDER BY updates.AcctSessionTime DESC LIMIT 1,2 Like you did in the outer query. Brent On Fri, Oct 17, 2008 at 5:12 AM, Ian Christian <[EMAIL PROTECTED]> wrote: > Hi all, > > I'm trying to work out the difference in a

Re: Confusion over query stratergy

2008-10-17 Thread Rob Wultsch
On Fri, Oct 17, 2008 at 10:31 AM, Ian Christian <[EMAIL PROTECTED]> wrote: > 2008/10/17 Rob Wultsch <[EMAIL PROTECTED]>: > > > *How long does the second query actually take to run compared to first? > > Actually, really quickly - so quickly that I also suspected that a > full table scan was not ta

Re: Confusion over query stratergy

2008-10-17 Thread Ian Christian
2008/10/17 Rob Wultsch <[EMAIL PROTECTED]>: > *How long does the second query actually take to run compared to first? Actually, really quickly - so quickly that I also suspected that a full table scan was not taking place. I'd like to understand how the output of EXPLAIN can differ from the act

Re: Confusion over query stratergy

2008-10-17 Thread Rob Wultsch
On Fri, Oct 17, 2008 at 9:56 AM, Rob Wultsch <[EMAIL PROTECTED]> wrote: > On Fri, Oct 17, 2008 at 2:12 AM, Ian Christian <[EMAIL PROTECTED]>wrote: > >> Hi all, >> >> I'm trying to work out the difference in a field between the last 2 >> updates in an updates table. I'm doing this as shown below:

Re: Confusion over query stratergy

2008-10-17 Thread Rob Wultsch
On Fri, Oct 17, 2008 at 2:12 AM, Ian Christian <[EMAIL PROTECTED]> wrote: > Hi all, > > I'm trying to work out the difference in a field between the last 2 > updates in an updates table. I'm doing this as shown below: > > mysql>SELECT >-> (@in - AcctInputOctets) AS AcctInputOctets,

Confusion over query stratergy

2008-10-17 Thread Ian Christian
Hi all, I'm trying to work out the difference in a field between the last 2 updates in an updates table. I'm doing this as shown below: mysql>SELECT -> (@in - AcctInputOctets) AS AcctInputOctets, -> (@out - AcctOutputOctets) AS AcctOutputOctets, -> (@in := AcctInp