Hello all,

I'm trying to do some processing on the front end to optimize my query on
the backend.  I would like to generate a list of id's for this query like
so:

SELECT REPLACE('3,4,5,6,7,8,9',',',' OR element_id=') INTO @tmp;

Then use it like:

mysql> select @tmp;
+---------------------------------------------------------------------------------------------------+
| @tmp                                                                    
                         |
+---------------------------------------------------------------------------------------------------+
| 3 OR element_id=4 OR element_id=5 OR element_id=6 OR element_id=7 OR
element_id=8 OR element_id=9 |
+---------------------------------------------------------------------------------------------------+
1 row in set (0.00 sec)

mysql> select * from display__Element where [EMAIL PROTECTED];
+------------+--------------+------------+
| element_id | display_name | data_units |
+------------+--------------+------------+
|          3 | Sync         |            |
+------------+--------------+------------+
1 row in set (0.00 sec)

mysql> select * from display__Element where element_id=3 OR element_id=4
OR element_id=5 OR element_id=6 OR element_id=7 OR element_id=8 OR
element_id=9;
+------------+---------------+------------+
| element_id | display_name  | data_units |
+------------+---------------+------------+
|          3 | Sync          |            |
|          4 | Graph Samples | V          |
|          5 | First E       | V          |
|          7 | Graph Sample  | V          |
|          8 | Test Graph    | V          |
+------------+---------------+------------+
5 rows in set (0.00 sec)

mysql>

The problem is that when I try to use a variable that is a string with
OR's contained, it only uses the first one.  Anybody know what is going on
here?

David Godsey


-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to