How about a query something like this:
SELECT position, title FROM WHERE position1 IN (1...200) OR position2 IN
(1...200);
Caviats:
1.) I don't do this everyday so that query syntax could be all wet
(probably is in fact). You may have to programaticly generate the IN
clauses to make it work. I don't think elipses are supported.
2.) I may have misunderstood the result set you're trying for.
In anycase, I think you can get ther general idea of what I have in
mind.
boris hajduk 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