Re: Rewriting query to avoid inline view

2008-04-29 Thread Rob Wultsch
schizophrenic Hi Rob, On Wed, Apr 23, 2008 at 6:47 AM, Rob Wultsch [EMAIL PROTECTED] wrote: On Wed, Apr 23, 2008 at 6:39 AM, Morten Primdahl [EMAIL PROTECTED] wrote: Thanks Rob and Baron, I'd never heard of the integers table approach before, really good stuff! If memory serves

Rewriting query to avoid inline view

2008-04-23 Thread Morten Primdahl
Hi, A user enters a date range (ie. 2 dates, '2008-04-01' and '2008-04-03'), the problem is to determine how many open events exist on each day in this interval. Assume that the events table has a start_date and an end_date. One way to solve this problem, is to create an inline view in the

Re: Rewriting query to avoid inline view

2008-04-23 Thread Baron Schwartz
Hi, On Wed, Apr 23, 2008 at 8:42 AM, Morten Primdahl [EMAIL PROTECTED] wrote: Hi, A user enters a date range (ie. 2 dates, '2008-04-01' and '2008-04-03'), the problem is to determine how many open events exist on each day in this interval. Assume that the events table has a

Re: Rewriting query to avoid inline view

2008-04-23 Thread Rob Wultsch
On Wed, Apr 23, 2008 at 5:42 AM, Morten Primdahl [EMAIL PROTECTED] wrote: Hi, A user enters a date range (ie. 2 dates, '2008-04-01' and '2008-04-03'), the problem is to determine how many open events exist on each day in this interval. Assume that the events table has a start_date and

Re: Rewriting query to avoid inline view

2008-04-23 Thread Sebastian Mendel
Baron Schwartz schrieb: Hi, On Wed, Apr 23, 2008 at 8:42 AM, Morten Primdahl [EMAIL PROTECTED] wrote: Hi, A user enters a date range (ie. 2 dates, '2008-04-01' and '2008-04-03'), the problem is to determine how many open events exist on each day in this interval. Assume that the events

Re: Rewriting query to avoid inline view

2008-04-23 Thread Rob Wultsch
On Wed, Apr 23, 2008 at 6:31 AM, Sebastian Mendel [EMAIL PROTECTED] wrote: Baron Schwartz schrieb: SQL magic i knew that you would answer this ... ;-) And he did it a minute or so faster than me... (though I did rip off his integers table way back when) -- Rob Wultsch [EMAIL PROTECTED]

Re: Rewriting query to avoid inline view

2008-04-23 Thread Morten Primdahl
Thanks Rob and Baron, I'd never heard of the integers table approach before, really good stuff! First off your porting over or dealing with formerly oracle code, right? Nah, I just learned SQL on Oracle back in the day. DUAL works under MySQL also - don't know since what revision, but

Re: Rewriting query to avoid inline view

2008-04-23 Thread Rob Wultsch
On Wed, Apr 23, 2008 at 6:39 AM, Morten Primdahl [EMAIL PROTECTED] wrote: Thanks Rob and Baron, I'd never heard of the integers table approach before, really good stuff! If memory serves postgres has something similar built in, so the syntax is something like seq(1..100) or something like