Mysql help

Miscellaneous Forums/General Discussion/Mysql help

I wasn't able to find an answer anywhere for something that seems so simple, and there seems to be quite a few mysql users here.

Is it possible to update a column, giving only the column index?

ex:

Update <table> set column(3) = '<value>'


Is there a way to update this way, or is the column name absolutely required?

Thanks

What is to guarantee that the third column is always the column you think it should be?

By using a name, it doesn't matter what pseudo order columns are in.

What is to guarantee that the third column is always the column you think it should be?


What do you mean? Why wouldn't it? Unless I manually move,delete or add a column (which I wouldn't...as my engine handles all the reindexing from adding/removing columns), then I don't understand how that would happen.

Also, without ranting on in a long explanation, my engine sends this data to several subservers that send the data to clients, so including the column names would really hinder my currently comfortable bandwidth usage.

There's several other things it would complicate if this is not possible.

You can use mysql_field_name() to get the name of a field, given a result set and field index... which I imagine you could then pass into your SELECT statement.

Of course, it would mean pre-fetching something from the required table, which you could then cache and use from an Array.

Alright, thank you brucey