表连接的难题在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. python3.4中自定义数组类(即重写数组类)

    '''自定义数组类,实现数组中数字之间的四则运算,内积运算,大小比较,数组元素访问修改及成员测试等功能''' class MyArray: '''保证输入值为数字元素(整型,浮点型,复数)''' de ...

  2. UA大全

    ####PC端UA #Opera "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Ch ...

  3. springboot aop 拦截接口执行时间

    /** * @description: 记录接口执行时间日志的记录 * @author: * @create 2018-12-27 16:32 */ @Target(ElementType.METHO ...

  4. magento 2.2.3 -/.gitignore -/.htaccess 分享

    /.htaccess ############################################ ## overrides deployment configuration mode v ...

  5. Codeforces 1092F Tree with Maximum Cost(树形DP)

    题目链接:Tree with Maximum Cost 题意:给定一棵树,树上每个顶点都有属性值ai,树的边权为1,求$\sum\limits_{i = 1}^{n} dist(i, v) \cdot ...

  6. git最基础操作一

    1. 从远端克隆:git clone -b 克隆的分支 git的地址( eg:git clone -b master https://gitee.com/test/test.git ) 2.提交修改的 ...

  7. QString与LPWSTR之间的转换;

    QString 转换成 LPWSTR LPWSTR lpStr = (LPWSTR) QString("nihao").toStdWString().c_str();

  8. 关于使用jwt编写接口时候对token判断时候错误的机制处理

    前言:php在使用接口时候很多时候都是需要带token的,如果不对token进行校验那么别人就能够随意编写一个token进入你的接口拿数据,应该怎样处理呢? //生成token public func ...

  9. Person Transfer GAN to Bridge Domain Gap for Person Re-identification

    目录 相关背景 主要内容 MSMT17 Person Transfer GAN(PTGAN) 总结 注:原创不易,转载请务必注明原作者和出处,感谢支持! 相关背景 行人再识别(Person Re-id ...

  10. jmeter中的函数

    1.函数帮助 1.tool-------->function helper dialog 可以查看函数帮助 2.jmeter中的函数 1.函数格式   ${__funcctionname(var ...