Jump to content

Select data from two tables at once


ShaolinF

Recommended Posts

Hi Guys,

 

Please take a look at the following two tables:

 

CREATE TABLE user (
user_id integer auto_increment NOT NULL,
first_name varchar(40) NOT NULL,
is_active enum('0','1') DEFAULT '1',
confirm_code int( NULL,
PRIMARY KEY  (user_id)
);

CREATE TABLE credit_remaining (
credit_amount_id integer auto_increment NOT NULL,
user_id integer NOT NULL,
credit_amount numeric(8,2) DEFAULT '0.0',
PRIMARY KEY (credit_amount_id),
FOREIGN KEY (user_id) REFERENCES user(user_id)
);

 

I want to select the user_id and first_name from the user table and credit_amount from the credit_remaining table. How can I do this in one statment?

 

 

.

Link to comment
https://forums.phpfreaks.com/topic/121951-select-data-from-two-tables-at-once/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.