表连接的难题在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. 文件实时同步(rsync+inotify)

    目标服务器:10.11.6.11 源服务器:10.11.6.12 准备条件: 1.关闭selinux: vi /etc/selinux/config #编辑防火墙配置文件 #SELINUX=enfor ...

  2. 【python 字符串】 字符串的相关方法(一)

    将字符串首字母变为大写 ->  capitalize() 方法 # 将字符串的首字母转换为大写 text = 'alet' ret = text.capitalize() print(ret) ...

  3. 调用webservice帮助类

    using System;using System.CodeDom;using System.CodeDom.Compiler;using System.Collections.Generic;usi ...

  4. C# 中使用面向切面编程(AOP)中实践代码整洁

    1. 前言 最近在看<架构整洁之道>一书,书中反复提到了面向对象编程的 SOLID 原则(在作者的前一本书<代码整洁之道>也是被大力阐释),而面向切面编程(Aop)作为面向对象 ...

  5. JS 基础知识点

    最近发现一个好东西,掘金小册,觉得里面的东西挺不错的,准备仔细阅读一下,提升下自己. 记录一下,随便加深点儿印象,主要内容源自于小册. 原始类型 原始类型也成为基本数据类型 boolean null ...

  6. ASP.Net笔记整理(一)

    验证码类 using System; using System.Collections.Generic; using System.Drawing; using System.Drawing.Draw ...

  7. 《深入理解java虚拟机》学习笔记-----郑雨迪

    一.学习java虚拟机的原因 二.java代码的运行 java -c 编译成.class 文件(java字节码) java字节码(.class文件)无法直接执行,因此,java虚拟机需要将字节码编译成 ...

  8. jatoolsprinter html实现每隔几秒获取数据直接后台打印不弹窗

    1.流程说明 jatoolspringter 必须要能在html代码里面看到  id =page1 page2 page3..... 才能打印,所以无法动态打印,必须先把要打印的内容放到页面某个地方隐 ...

  9. ab命令

    ab -V -n在测试会话中所执行的请求个数.默认时,仅执行一个请求.请求的总数量 -c一次产生的请求个数.默认是一次一个.请求的用户量 -t测试所进行的最大秒数.其内部隐含值是-n 50000,它可 ...

  10. Codeforces Round #544 (Div. 3) D F1 F2

    题目链接:D. Zero Quantity Maximization #include <bits/stdc++.h> using namespace std; #define maxn ...