"TonyMJ" <to**@nospam.jantony.co.uk> wrote in message
news:Cq**************@stones.force9.net...
Hi,
is it possible to SELECT a column by number rather than name? I can't find
this anywhere in the manual.
It's for a generalised function on a set of tables with different
fieldnames where I always want to select values by the value of the first field.
TIA
Tony
I actually read this just recently in my MySQL book but I've not tried it -
I believe you can, and columns start at 1 (being the leftmost column).
But becareful because if you later alter your table, or have a script that
creates the table with columns in a different order, you could end up
getting your twists in your knickers...
What have you got against using the column names? It will help you alot
if/when you, or someone else has to modify your code in the future...
randelld