Select from 2 tables

Not for 'how-to' coding questions but PHP theory instead, this forum is here for those of us who wish to learn about design aspects of programming with PHP.

Moderator: General Moderators

Post Reply
bwan37
Forum Newbie
Posts: 9
Joined: Thu May 22, 2008 11:42 am

Select from 2 tables

Post by bwan37 »

I try to do this on the following 2 table... but return "ERROR: Table does not exist"
Can anyone give me some help? Thanks a lot :D

SELECT category.name FROM category, category_used WHERE category.id = category_used.category_id

Here's my 2 tables:
CREATE TABLE category (
id int(2) AUTO_INCREMENT,
name varchar(16) NOT NULL,
PRIMARY KEY(id)
);

CREATE TABLE category_used (
category_id int(2) AUTO_INCREMENT,
model_num varchar(16),
PRIMARY KEY(category_id, model_num)
);
User avatar
requinix
Spammer :|
Posts: 6617
Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA

Re: Select from 2 tables

Post by requinix »

If the error says the table does not exist then I would have to venture a guess that the table does not exist.

Are you connecting to the right server? Using the right database?
Post Reply