List:General Discussion« Previous MessageNext Message »
From:Anvar Hussain K.M. Date:November 19 2001 4:24am
Subject:Re: many similar requests -> 1 request
View as plain text  
Hi Boris,

Try this:

Select ifnull(position1,0)+ifnull(position2,0) As slno, title from book 
where ifnull(position1,0)+ifnull(position2,0) <= 200 order by slno

Anvar.

At 09:49 PM 17/11/2001 +0100, you wrote:
>hi fellow mysql users :)
>
>i'm programming a little application, and i do the following :
>
>
>for ($i=0 ; $i<200 ; $i++)
>{
>   $result=mysql_query("select $i, title from book where position1=$i \
>                        or position2=$i"); // this query returns only 1 row
>   $row=mysql_fetch_row($result);
>   print("position: $row[0]  --   title: $row[1]  \n");
>}
>
>this generates 200 sql queries... :/
>
>do you see a way to make 1 sql query that would return my 200 rows ?
>
>maybe something like :
>select "(increment j 0 -> 200)" , title from book where position1=j \
>   or position2=j;
>
>
>note: given a number between 0 and 199, the number is stored in
>position1 OR position2 , but never both.
>
>any idea ?
>
>--
>  Boris Hajduk                   bhajduk@stripped
>
>
>---------------------------------------------------------------------
>Before posting, please check:
>    http://www.mysql.com/manual.php (the manual)
>    http://lists.mysql.com/         (the list archive)
>
>To request this thread, e-mail <mysql-thread91588@stripped>
>To unsubscribe, e-mail 
><mysql-unsubscribe-itecsoft=zyberway.com@stripped>
>Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

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