MYSQL if statement question...
- by Dennis_M
Is there any way to get the if statement to evaluate a query?
SELECT if(50,'EQ_Type','*') FROM EQUIPMENT;
Resulting in:
+-----------------------+
| IF(50,'EQ_Type','*') |
+-----------------------+
| EQ_Type |
| EQ_Type |
| EQ_Type |
| EQ_Type |
| EQ_Type |
| EQ_Type |
| EQ_Type |
| EQ_Type |
| EQ_Type |
+-----------------------+
9 rows in set (0.00 sec)
I would like the above statement to be equivalent to the following:
SELECT 'EQ_Type' FROM EQUIPMENT;
And produce:
+--------------+
| EQ_Type |
+--------------+
| ENGINE |
| ENGINE |
| ENGINE |
| TRAILER |
| TRAILER |
| TRAILER |
| WATER TENDER |
| WATER TENDER |
| WATER TENDER |
+--------------+
Thanks for any help