Jump to content

Do stuff instead of column


Recommended Posts

Can somebody please tell me how I can change my database so that it will do something else when a certain column is used (which isn't actually in that table)?


Like for example so that

select `MOO` from `database`.`table`

would act like

select substring_index(`row`,' ',99)as `MOO` from `database`.`table`


Link to comment
Share on other sites

I'm not sure that you'll be able to find anything like that in MySQL. This DB doesn't support functions like PostgreSQL or some other heavier weight database systems do. You may get by with creating a view that contains the definition of the column that you are after and simply selecting the column from the view instead.


Hope this helps.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.