[UPHPU] SQL field as prefix for all fields
llihttocs at gmail.com
Mon Jan 28 16:14:36 MST 2008
> The AS option in an SQL command allows you to rename a field, like this:
> select username as user, password as secretcode
> Is it possible to rename all of the fields that you pull at once?
> Here's what I want to do:
> I have a table of fields that are all named with the same prefix. I
> want to rename them as they are pulled from the DB with a different
> prefix. Is that possible?
> I have never heard of anything like this in SQL. You are probably stuck
with renaming all of the columns in the SQL statement. If you are using
Postgres or something besides MySQL you might do something like this in a
stored procedure although I have never tried it. It would be neat if
someone could figure out a nifty way to do this.
Food for thought:
An eagle may soar but a weasel will never get sucked into a jet engine.
A closed mouth gathers no foot.
Never squat with your spurs on.
More information about the UPHPU