OSEC

Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com
CONCAT with IF?

From: Matt Neimeyer (mattneimeyer.org)
Date: Wed Jul 08 2009 - 16:44:38 CDT


I want to store the product version that an article applies to and a
comparison operator in my news system. But I can't wrap my head around
the where clause...

Here's what I've tried...

CREATE TABLE test (version char(10), direction char(2));

select concat("6.0",direction,version) as operation from test;

+---------+
|operation|
+---------+
| 6.0=6.0
| 6.0>=6.0
| 6.0<6.1
| 6.0>6.2
+---------+

But when I do select if(concat("6.0",direction,version),"Y","N") from
test I ALWAYS get "Y"... which means I wouldn't get any meaningful
results if I used it in a where clause...

Any ideas on ways I can do this?

Thanks!

Matt

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql