Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Substitute one field with value of another one ? 1

Status
Not open for further replies.

jorgen180

Programmer
Mar 21, 2004
3
HR

Hi, everyone.


If I have a Table 1 with these fields:



Name | Surname | Function


record sample:


Joe | Blow | 430


...and Table 2 with two fields, first one having IDs of Table 1's "Function" field and second one with their description:


ID | Description


record sample:


430 | IT manager



How would I do queries on Table 1 to pull out description from Table 2 instead of ID value of "Function" field in Table 1 ? In other words, I need to substitute ID codes from Table 1 with Descriptions from Table 2, making a kind of relational queries.


I know there's a way of using query inside another query, but have no idea how to get current record's field and pull other table's substitution instead of it, all in one query.


Thank you for all suggestions !

 
How about:

[tt]SELECT name,surname,description FROM table1 JOIN table2 ON function=id[/tt]


-----
ALTER world DROP injustice, ADD peace;
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top