Forum Moderators: coopster & phranque

Message Too Old, No Replies

MySQL query syntax

To retrieve info in one SELECT statement

         

Birdman

9:55 pm on May 9, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hello,

I know MySQL basics but I tend to do things innefficiently, due to lack of advanced knowledge. What I want to know is, if there is a way to retrieve all the info I need(I'll explain below) in one shot, rather than querying the server multiple times for one web page.

The situation

I'm basically building a small(one page,as of now) link directory for my site. Actually, the directory is already there but I'm moving all info to a database for easier manipulation.

I have two tables in the db: link_partners and categories

In link_partners I have a field called partner_cat, which gives the category id they belong in.

It's a traditional layout with jump-to links at the top of the page for each category below. Is there a way I can pull all the info I need from both tables in one SELECT and then be able to:

1) Build jump-to links
2) Build each section with header(category_name) and partner links from that section

I would appreciate any insight on this. Hopefully it will get me on the right track to handling my db more effeciently.

Cheers,
Birdman

willybfriendly

10:16 pm on May 9, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hi Birdman.

Read about table joins at [mysql.com...] (Hope it is alright to post this link)

WBF