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 follow
Sunday, November 18, 2001, 1:26:23 AM, Sergei wrote:
SG> Or you can emulate UNION with temporary table.
SG> CREATE TEMPORARY xxx SELECT ...
SG> INSERT xxx SELECT ...
SG> SELECT xxx ...
I used this solution for a good reason : it seems cleaner than the
1..200 thing
:) Thank you so much !
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 o
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.2
Hi!
On Nov 17, Sergei Golubchik wrote:
> Hi!
>
> On Nov 17, boris hajduk wrote:
> > Saturday, November 17, Bruce Ferrell wrote:
> >
> > BF> SELECT position, title FROM WHERE position1 IN (1...200) OR position2 IN
> > BF> (1...200);
> >
> > no, i wasn't clear enough, let's try it again.
> >
> >
Hi!
On Nov 17, boris hajduk wrote:
> Saturday, November 17, Bruce Ferrell wrote:
>
> BF> SELECT position, title FROM WHERE position1 IN (1...200) OR position2 IN
> BF> (1...200);
>
> no, i wasn't clear enough, let's try it again.
>
> the table book contains :
>
> |-- title -|--position1--|
Saturday, November 17, Bruce Ferrell wrote:
BF> SELECT position, title FROM WHERE position1 IN (1...200) OR position2 IN
BF> (1...200);
no, i wasn't clear enough, let's try it again.
the table book contains :
|-- title -|--position1--|--position2--|--lots of other fields---
| bravenewworl
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.
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);