Page 1 of 1

Easiest way of converting an id to name

Posted: Wed Jul 14, 2010 10:30 am
by mikeman
If you have a table containing many different ids that each have their names stored on another table is there an easy way of converting that id to a name.

Or would you have to have lots of SQL statements fetching the name for that id on each table?

Re: Easiest way of converting an id to name

Posted: Wed Jul 14, 2010 12:29 pm
by AbraCadaver
It's not lots of SQL, just this if I understand correctly and assuming that the tables are related on the id column:
[text]
SELECT name FROM ids_table, names_table WHERE ids_table.id = names_table.id[/text]