[SQL] 2 left join taking in too many records, 1 join and 1 left join too few was: join

2009-03-18 Thread Ivan Sergio Borgonovo
first, sorry for the subject. I started editing the body and I forgot the subject looked nearly meaningless. I solved this using a view on catalog_promosimpleitem and catalog_promosimple that just take out the record I'm interested into. If no record, the left join on the view should make it

Re: [SQL] How do I optimize this?

2009-03-18 Thread Richard Huxton
Wei Weng wrote: I made a mistake in the queries: They should be update T set t1 = b.aa FROM (select COUNT(1) as aa FROM D WHERE D.da = 1) as b where tkey = value; update T set t2 = b.aa FROM (select COUNT(1) as aa FROM D WHERE D.da = 2) as b where tkey = value; ... update T set t10 =

Re: [SQL] SQL to Check whether AN HOUR PERIOD is between start and end timestamps

2009-03-18 Thread Srikanth
That did the job. Thanks. Am new to SQL, does not even know that there exists an Operator called OVERLAPS. Thanks Richard ../rssrik --- On Tue, 17/3/09, Richard Huxton d...@archonet.com wrote: From: Richard Huxton d...@archonet.com Subject: Re: [SQL] SQL to Check whether AN HOUR PERIOD is