Codxplore.com

Latest news:

New android application Islamic Video has been released. its a free islamic video application for android smartphone. Download now!

How to create virtual column using MySQL SELECT?


something like

    SELECT id, email, IF(actived = 1, 'enabled', 'disabled') AS account_status
FROM users

this allow you to make operations and show it as columns.

EDIT:

you can also use joins and show operaitons as columns:

    SELECT u.id, e.email, IF(c.id IS NULL, 'no selected', c.name) as country
FROM users u LEFT JOIN countries c ON u.country_id = c.id

See the 
http://stackoverflow.com/questions/455261/how-to-create-virtual-column-using-mysql-select

for refference

Tags : MySQL,

Views : 1592

Subscribe Us


Follow Us