Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Data Bases > Databases General > Re: Complex que...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 6 of 6 Topic 3092 of 3295
Post > Topic >>

Re: Complex query - PLEASE HELP! [Solved]

by Thomas Kellerer <FJIFALSDGVAF@[EMAIL PROTECTED] > Feb 6, 2008 at 12:07 AM

strawberry wrote on 05.02.2008 23:34:
> On Feb 3, 1:39 am, "S." <sianeag...@[EMAIL PROTECTED]
> wrote:
>> Thanks Thomas,
>>
>> That was exactly what i was after!
>>
>> S.
> 
> 5 stars!  For that! Too generous! ;-)
> 
> I think there must be a solution that doesn't require a subquery but
> my brains a bit frazzled today. I think it could be something along
> these lines, but I'd have to extend the dataset to be sure:
> 
> SELECT t1.*
> FROM orders t1
> LEFT JOIN orders t2
> ON t1.customer = t2.customer
> AND t1.orderdate < t2.orderdate
> AND t2.orderdate < '2007-12-20'
> WHERE t2.id IS NULL
> HAVING orderdate < '2007-12-20';

A subquery is not necessarily slower or less efficient than a join. But
that 
depends on the DBMS and the indexes available for the involved tables.

Tomas
 




 6 Posts in Topic:
Complex query - PLEASE HELP!
"S." <sianea  2008-02-01 23:30:03 
Re: Complex query - PLEASE HELP!
Lennart <Erik.Lennart.  2008-02-02 01:30:03 
Re: Complex query - PLEASE HELP!
Thomas Kellerer <FJIFA  2008-02-02 11:26:24 
Re: Complex query - PLEASE HELP! [Solved]
"S." <sianea  2008-02-02 17:39:01 
Re: Complex query - PLEASE HELP! [Solved]
strawberry <zac.carey@  2008-02-05 14:34:44 
Re: Complex query - PLEASE HELP! [Solved]
Thomas Kellerer <FJIFA  2008-02-06 00:07:41 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Fri Dec 5 10:20:47 CST 2008.