Jim Elliott
Jim Elliott

Reputation: 37

Create a non-existent field in MySQL view

If possible I want to create a non-existent field in a MySQL view.

Say select * from authors

Then, if there is a field living and it is 1, I want to add a field image and assign it a value of tick.gif. Is this possible?

It is so I can easily use a rather flash grid program!

Upvotes: 0

Views: 103

Answers (1)

tijs
tijs

Reputation: 566

you can try

select a.*, if(a.living = 1, "tick.gif", NULL) as image from authors a

Upvotes: 1

Related Questions