List:General Discussion« Previous MessageNext Message »
From:Sergei Golubchik Date:November 18 2001 12:26am
Subject:Re: many similar requests -> 1 request
View as plain text  
Hi!

On Nov 18, boris hajduk wrote:
> SG> Correction - this one is wrong, it will list each entry only once.
> 
> confirmed :)
> 
> 
> >> SELECT position1 as position,title WHERE position1 IN ($_) UNION
> >> SELECT position2 as position,title WHERE position2 IN ($_) ORDER BY
> position;
> SG> This one is ok.
> 
> what about a way that would work with 3.23 ? :))

If you're using Perl anyway, then do it with two selects and sort in
perl. 200 lines is nothing for perl.

Or you can emulate UNION with temporary table.

  CREATE TEMPORARY xxx SELECT ...
  INSERT xxx SELECT ...
  SELECT xxx ...

Or...

  CREATE TABLE nums (position INT UNSIGNED NOT NULL AUTO_INCREMENT);

fill it with 1..200 (you can do it only once, of course) and

  SELECT position,title FROM nums,books WHERE position1=position OR
                 position2=position ORDER BY position;

> (ah, damn real-life admins, who don't want to upgrade before 6 months
> of proven reliability)

I can understand that :-)

Regards,
Sergei

-- 
MySQL Development Team
   __  ___     ___ ____  __
  /  |/  /_ __/ __/ __ \/ /   Sergei Golubchik <serg@stripped>
 / /|_/ / // /\ \/ /_/ / /__  MySQL AB, http://www.mysql.com/
/_/  /_/\_, /___/\___\_\___/  Osnabrueck, Germany
       <___/
Thread
many similar requests -> 1 requestboris hajduk17 Nov
  • Re: many similar requests -> 1 requestBruce Ferrell17 Nov
    • Re: many similar requests -> 1 requestboris hajduk17 Nov
      • Re: many similar requests -> 1 requestSergei Golubchik17 Nov
        • Re: many similar requests -> 1 requestSergei Golubchik17 Nov
          • Re: many similar requests -> 1 requestboris hajduk18 Nov
            • Re: many similar requests -> 1 requestSergei Golubchik18 Nov
              • Re[2]: many similar requests -> 1 requestboris hajduk18 Nov
Re: many similar requests -> 1 requestAnvar Hussain K.M.19 Nov