From: Mogens Melander Date: December 9 2008 5:07pm Subject: Re: Uptimize: join table on if() List-Archive: http://lists.mysql.com/mysql/215546 Message-Id: <30d90c42ef58e41d04043160b21e274a.squirrel@mail.fumlersoft.dk> MIME-Version: 1.0 Content-Type: text/plain;charset=utf-8 Content-Transfer-Encoding: 8bit Hmmm, no. That's not it. The 2 queries using if() return the right number of rows. The union return too few. Anyway. I ended up with a query that runs in about 1 sec. compared to the original that ran about 3 min. I'm happy :) Thanks a bunch. On Tue, December 9, 2008 14:53, Thomas Pundt wrote: > On Dienstag, 9. Dezember 2008, Mogens Melander wrote: > | I can't figure out why the "UNION" solution is missing 4 rows. I'll include > | the 3 complete statements, so maybe someone smarter than me can figure out > | why there's a difference in the result. > > Without having "studied" your query, my guess would be: double rows. UNION > eliminates those; if you need them, use "UNION ALL". Just a guess though... > > Ciao, > Thomas > > -- > Thomas Pundt ---- http://rp-online.de/ ---- -- Later Mogens Melander -- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean.