table in table...

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
User avatar
pHaZed
Forum Commoner
Posts: 28
Joined: Wed May 01, 2002 2:44 am
Location: Sydney -AU

table in table...

Post by pHaZed »

I need some help with what I think may be table joins... :?
The problem is I have a table which contains all the information for a text file archive system, In another table I want to have all the catergorys for the text files to be sorted to.
is there anyway possible of having the catergorys table inside the information table...or use some sort of table join...?
User avatar
mikeq
Forum Regular
Posts: 512
Joined: Fri May 03, 2002 3:33 am
Location: Edinburgh, Scotland

Post by mikeq »

Can you post a sample of your data?

but if you had 2 tables say FILES and CATEGORIES and each record in the FILES table had a field CATEGORY_ID which related to a record in the CATEGORIES table, each record in the CATEGORIES table would have CATEGORY_ID as its primary key.

The following SQL would get you what you want

select *
from FILES f, CATEGORIES c
where f.CATEGORY_ID = c.CATEGORY_ID
order by c.CATEGORY_ID
Post Reply