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                   [EMAIL PROTECTED]
>
>
>---------------------------------------------------------------------
>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 <[EMAIL PROTECTED]>
>To unsubscribe, e-mail 
><[EMAIL PROTECTED]>
>Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php


---------------------------------------------------------------------
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 <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to