我必须从两个表中加入数据。 有三个表记录,地址和名称.Id是记录表中的主键和地址和名称表中的外键。特定记录可以有多个名称记录。使用mysql从三个表中读取数据
RECORD(id (PK),text,search)
address(address_id(PK),type,street,city, id (FK))
name(name_id(PK),name,id (FK))
I want to get the data from these three tables in a way so that i will get the only first name record for each record id,not all the name records for record id's.
insert into RECORD values (1,record1,record1search);
insert into RECORD values (2,record2,record2search);
insert into name values (1,xxx,1);
insert into name values name(2,yyy,1)
insert into name values name(3,zzz,2)
i want to retriev the values in way:
record_id,text,namename_id:
1,record1,xxx,1
2,record2,zzz,3
我想只有第一个名字记录不是第二个或第三个名字记录的特定记录。
请大家帮忙。