表连接的难题在mycat中是不允许跨分片做表连接查询的

创建t_orders表

create table t_orders(

id int PRIMARY key,

customer_id int not null,

datetime TIMESTAMP DEFAULT CURRENT_TIMESTAMP

);

#################################################

use chinasoft;

create table t_customer(

id int primary key,

username varchar(200) not null,

sharding_id int not null

);

use chinasoft;

select * from t_customer;

insert into t_customer(id,username,sharding_id) values(1,"tom",101);

insert into t_customer(id,username,sharding_id) values(2,"jack",102);

insert into t_customer(id,username,sharding_id) values(3,"smith",105);

insert into t_customer(id,username,sharding_id) values(4,"lily",102);

insert into t_customer(id,username,sharding_id) values(5,"lucy",103);

insert into t_customer(id,username,sharding_id) values(6,"hanmeimei",104);

create table t_orders(

id int PRIMARY key,

customer_id int not null,

datetime TIMESTAMP DEFAULT CURRENT_TIMESTAMP

);

INSERT into t_orders(id,customer_id) values(1,1);

INSERT into t_orders(id,customer_id) values(2,1);

INSERT into t_orders(id,customer_id) values(3,1);

select c.username,o.id,o.datetime from t_customer c join t_orders o on c.id=o.customer_id;

05mycat父子表的更多相关文章

  1. JS组件系列——表格组件神器:bootstrap table(二:父子表和行列调序)

    前言:上篇 JS组件系列——表格组件神器:bootstrap table 简单介绍了下Bootstrap Table的基础用法,没想到讨论还挺热烈的.有园友在评论中提到了父子表的用法,今天就结合Boo ...

  2. mybatis父子表批量插入

    <!--父子表批量插入 --> <insert id="insertBatch" parameterType="com.niwopay.dto.beni ...

  3. Sharepoint2010之父子表实现

    在Sharepoint的实际运用中会经常使用到父子表来建立2个表之间的关系.通常父表为表头,存储公共的数据项目,子表存储细分的项目. 例如通过下面2个表实现图书借阅功能,表1为图书的基础信息,表2为图 ...

  4. bootstrap-table 父子表入门篇

    官方文档:http://bootstrap-table.wenzhixin.net.cn/zh-cn/documentation/#多语言 一.引入js.css <!-- 引入bootstrap ...

  5. mysql 父子表 注意事项

    今天遇到一个问题,父子表关联查询时总是多出几条数据,后来排查是父子关系的字段 类型不一致导致的

  6. SQL 父子表,显示表中每条记录所在层级

    1.sqlserer 中有一张父子关系表,表结构如下: CREATE TABLE [dbo].[testparent]( [ID] [int] IDENTITY(1,1) NOT NULL, [nam ...

  7. sql父子表结构,常用脚本

    在实际运用中经常会创建这样的结构表Category(Id, ParentId, Name),特别是用于树形结构时(菜单树,权限树..),这种表设计自然而然地会用到递归,若是在程序中进行递归(虽然在程序 ...

  8. DevExpress中GridColumnCollection实现父子表数据绑定

    绑定数据: 父表: DataTable _parent = _dvFlt.ToTable().Copy(); 子表: DataTable _child = _dvLog.ToTable().Copy( ...

  9. bootstrap-table 实现父子表

    1.引入相关的css和js <link type="text/css" href="/components/bootstrap/3.3.7/css/bootstra ...

随机推荐

  1. 微信小程序-表单笔记2

    本地添加4张图片并显示至页面——组件位置.设置样式.列表渲染 Q.button是一张图片,需要实现点击这张图片后选择本地图片后显示至页面,不知道怎么让本地图片将button挤到右边  S.在wxml中 ...

  2. Hyperscan-5.1.0 安装

    安装依赖ragel ragel源码下载地址 编译安装 $ tar -xvf ragel-6.10.tar.gz $ cd ragel-6.10 $ ./configure $ make $ sudo ...

  3. PHP细节,empty,is_null,isset,if()

    以下内容转载自http://wuxinjie.github.io/php-04/ 从下表可知,empty与if()完全相反,is_null与isset完全相反 isset是语句,is_null是函数, ...

  4. linux基本命令2

    目录: 目录: /bin:可执行文件 /sbin:系统文件 /dev:设备文件 命令: mkdir test cd test touch 11.txt vi 11.txt cat 11.txt cp ...

  5. 一道B树的题目---先记一下, 还没看到B树

    D

  6. Spring Boot + Netty 中 @Autowired, @Value 为空解决

    问题描述 使用 Spring Boot + Netty 新建项目时 Handler 中的 @Autowired, @Value 注解的始终为空值 解决方法 @Component // 1. 添加 @C ...

  7. 17年iPhone炫酷铃声,mp3、m4r格式下载

    下载链接: https://pan.baidu.com/s/11aj9dBm9upNWpE5jWBgYog

  8. 聊聊 Scala 的伴生对象及其意义

    2019-04-22 关键字:Scala 伴生对象的作用 关于 Scala 伴生对象,比教材更详细的解释. 什么是伴生对象? 教材中关于伴生对象的解释是:实现类似 Java 中那种既有实例成员又有静态 ...

  9. CentOS 7 网卡配置对比

    1.DHCP模式(原始) [root@centos7-minimal /]# vim /etc/sysconfig/network-scripts/ifcfg-eno16777736 TYPE=&qu ...

  10. python_类与对象学习笔记

    class Phone: #手机属性===>类属性 # color='black' # price=4500 # brand='oppo' # size='5.5' #参数化-魔法方法--初始化 ...