我有三张桌子。1. bni_category 2. bni_chapter 3. bni_member
CREATE TABLE `bni_category` (
`bni_category_id` int(11) NOT NULL,
`bni_category_name` text,
`is_active` int(1) NOT NULL DEFAULT '1',
`is_delete` int(1) NOT NULL DEFAULT '0',
`last_update` datetime DEFAULT NULL,
`bni_chapter_id` int(20) NOT NULL,
create_date` varchar(50) NOT NULL,
PRIMARY KEY (`bni_category_id`),
KEY `bni_chapter_id` (`bni_chapter_id`),
CONSTRAINT `bni_category_ibfk_1` FOREIGN KEY (`bni_chapter_id`)
REFERENCES `bni_chapter` (`bni_chapter_id`),
) ENGINE=InnoDB DEFAULT CHARSET=latin1
BNI_章节
CREATE TABLE `bni_chapter` (
`bni_chapter_id` int(11) NOT NULL,
`bni_chapter_name` varchar(50) DEFAULT NULL,
`create_date` varchar(50) NOT NULL,
`is_active` int(1) NOT NULL DEFAULT '1',
`is_delete` int(1) NOT NULL DEFAULT '0',
`last_update` varchar(50) DEFAULT NULL,
PRIMARY KEY (`bni_chapter_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
BNI_member
CREATE TABLE `bni_member` (
`bni_member_id` int(11) NOT NULL AUTO_INCREMENT,
`bni_member_name` text,
`bni_member_mobile` varchar(13) DEFAULT NULL,
`bni_member_email` text,
`bni_member_website` text,
`bni_member_bio` text,
`bni_member_export_to` text,
`bni_member_import_from` text,
`bni_member_want_to_connect_to` text,
`bni_member_company` text,
`bni_chapter_id` int(11) DEFAULT NULL,
`bni_category_id` int(11) DEFAULT NULL,
`bni_member_address` text,
`bni_member_commitee` text,
`bni_member_profilepic` longblob NOT NULL,
`bni_member_logo` longblob NOT NULL,
`create_date` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
`is_active` int(1) NOT NULL DEFAULT '1',
`is_delete` int(1) NOT NULL DEFAULT '0',
`last_update` text,
`del_status` varchar(50) NOT NULL,
PRIMARY KEY (`bni_member_id`),
KEY `bni_chapter_id` (`bni_chapter_id`),
KEY `bni_category_id` (`bni_category_id`),
KEY `bni_member_id` (`bni_member_id`),
CONSTRAINT `bni_member_ibfk_1` FOREIGN KEY (`bni_chapter_id`) REFERENCES
`bni_chapter` (`bni_chapter_id`),
CONSTRAINT `bni_member_ibfk_2` FOREIGN KEY (`bni_category_id`)
REFERENCES `bni_category` (`bni_category_id`)
) ENGINE=InnoDB AUTO_INCREMENT=223 DEFAULT CHARSET=latin1
现在我想显示 bni_member_name bni_member_id bni_chapter_id bni_chapter_name bni_category_id bni_category_name FROM bni_member 和章节 id,章节名称形成章节表和类别 ID,类别名称形成类别表。
决赛桌应该看起来像
Member Id | Member Name | Chapter Id | Chapter Name | Category Id
|category Name