阅读背景:

如何从多个表中选择和匹配?

来源:互联网 

This is my table layout:

这是我的表格布局:

-- Table structure for table `areas`
CREATE TABLE IF NOT EXISTS `areas` (
  `ID` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `user_id` bigint(20) unsigned NOT NULL,
  `country` varchar(20) NOT NULL,
  `city` varchar(20) NOT NULL,
  PRIMARY KEY (`ID`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

-- Table structure for table `matches`
CREATE TABLE IF NOT EXISTS `matches` (
  `ID` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `user_id` bigint(20) unsigned NOT NULL,
  `view_id` bigint(20) unsigned NOT NULL,
  `status` enum('h','n') NOT NULL,
  `exp_date` date NOT NULL,
  PRIMARY KEY (`ID`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

-- Table structure for table `users`
CREATE TABLE IF NOT EXISTS `users` (
  `ID` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `limit_age` varchar(5) NOT NULL DEFAULT '18:30',
  `limit_gender` varchar(2) DEFAULT NULL,
  `notifications` int(11) NOT NULL DEFAULT '0',
  `name` varchar(30) NOT NULL,
  `email` varchar(40) NOT NULL,
  `image_big` varchar(120) NOT NULL,
  `image_small` varchar(120) NOT NULL,
  `crop_data` int(11) DEFAULT NULL,
  `visible` tinyint(1) NOT NULL DEFAULT '0',
  `age` int(11) DEFAULT NULL,
  `registered_at` datetime NOT NULL,
  `views` bigint(20) unsigned NOT NULL DEFAULT '0',
  `hots` bigint(20) unsigned NOT NULL DEFAULT '0',
  PRIMARY KEY (`ID`)
) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=15 ;
-- Table



你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: