hi!
i have the following two tables:
CREATE TABLE kontakt (
kontakt_id smallint(4) unsigned NOT NULL auto_increment,
kd_id smallint(5) unsigned NOT NULL default '0',
<more fields...> ,
PRIMARY KEY (kontakt_id)
) TYPE=MyISAM;
CREATE TABLE kunden (
kd_id smallint(5) unsigned NOT NULL auto_increment,
name varchar(255) NOT NULL default '',
rechnung_id smallint(5) unsigned NOT NULL default '0',
PRIMARY KEY (kd_id)
) TYPE=MyISAM;
i would like to make a query joining the data from both tables for a specific record, identified by kd_id, which has to be the same in both tables.
how would i do that?
so far i have succeeded to receive the information wanted for the last of all records by using SELECT * FROM kunden INNER JOIN kontakt USING (kd_id).
but SELECT * FROM kunden INNER JOIN kontakt USING (kd_id) WHERE kunden.kd_id=$id ($id being the specification of the record wanted) doesn't work.
tia!
matthias