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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

JOIN needed??

Status
Not open for further replies.

shamrox

Programmer
Sep 27, 2001
81
US
I'm not to versed with using joins, so I don't know if it's what i need to use here.

I have several tables in my db. main table is related to other tables by id. for example, i have a table that lists company names, and a unique id for each company. in the main table, there is a field for the company id. now, when I do queries for outputting records from the main table, how do I get the company name to appear and not the id? do i use a join and how do i write that?

secondly, i have a php page that lists all the records in a table with links to a detail page. once getting to the detail page, i again want to substitute the id for the actual name when I output to the screen. again, another join???

thanks for any help. i'm sure i have been more than confusing above...
also, if someone has a good resource for understanding how to properly right SELECT statements, with JOINS, etc, aside from the documentation site (not useful for a newbie), that would also be appreciated.

 
select t1.co_name, t2.some_col where t1.id = t2.co_id


Bastien

Cat, the other other white meat
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top