05mycat父子表
表连接的难题在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父子表的更多相关文章
- JS组件系列——表格组件神器:bootstrap table(二:父子表和行列调序)
前言:上篇 JS组件系列——表格组件神器:bootstrap table 简单介绍了下Bootstrap Table的基础用法,没想到讨论还挺热烈的.有园友在评论中提到了父子表的用法,今天就结合Boo ...
- mybatis父子表批量插入
<!--父子表批量插入 --> <insert id="insertBatch" parameterType="com.niwopay.dto.beni ...
- Sharepoint2010之父子表实现
在Sharepoint的实际运用中会经常使用到父子表来建立2个表之间的关系.通常父表为表头,存储公共的数据项目,子表存储细分的项目. 例如通过下面2个表实现图书借阅功能,表1为图书的基础信息,表2为图 ...
- bootstrap-table 父子表入门篇
官方文档:http://bootstrap-table.wenzhixin.net.cn/zh-cn/documentation/#多语言 一.引入js.css <!-- 引入bootstrap ...
- mysql 父子表 注意事项
今天遇到一个问题,父子表关联查询时总是多出几条数据,后来排查是父子关系的字段 类型不一致导致的
- SQL 父子表,显示表中每条记录所在层级
1.sqlserer 中有一张父子关系表,表结构如下: CREATE TABLE [dbo].[testparent]( [ID] [int] IDENTITY(1,1) NOT NULL, [nam ...
- sql父子表结构,常用脚本
在实际运用中经常会创建这样的结构表Category(Id, ParentId, Name),特别是用于树形结构时(菜单树,权限树..),这种表设计自然而然地会用到递归,若是在程序中进行递归(虽然在程序 ...
- DevExpress中GridColumnCollection实现父子表数据绑定
绑定数据: 父表: DataTable _parent = _dvFlt.ToTable().Copy(); 子表: DataTable _child = _dvLog.ToTable().Copy( ...
- bootstrap-table 实现父子表
1.引入相关的css和js <link type="text/css" href="/components/bootstrap/3.3.7/css/bootstra ...
随机推荐
- 软工+C(4): Alpha/Beta换人
// 上一篇:超链接 // 下一篇:工具和结构化 注:在一次软件工程讨论课程进度设计的过程中,出现了这个关于 Alpha/Beta换人机制的讨论,这个机制在不同学校有不同的实施,本篇积累各方观点,持续 ...
- Appium could not connect to server are you sure it's running appium desktop
use remote host value : 127.0.0.1 switch to Custom server to Automatic server adb kill-server adb st ...
- Windows系统下的TCP参数优化(注册表\TCPIP\Parameters)
转自:https://blog.csdn.net/libaineu2004/article/details/49054261 Windows系统下的TCP参数优化 TCP连接的状态与关闭方式及其对 ...
- Python 安装 (win10)
1. 下载python 网址: python.org 版本: 2.7 安装包名字: Windows x86-64 MSI installer 一路next. 2. 配置环境变量: path 里面添加p ...
- js 实现数据结构 -- 字典
原文: 在Javascript 中学习数据结构与算法. 概念: 集合.字典.散列表都可以存储不重复的数据.字典和我们上面实现的集合很像. 当然,字典中的数据具有不重复的特性.js 中 Object 的 ...
- 【10】Cookie和Session
一.cookie和session的介绍 cookie不属于http协议范围,由于http协议无法保持状态,但实际情况,我们却又需要"保持状态",因此cookie就是在这样一个场景下 ...
- 树莓派3B+(三)
上一篇中,我们配置好了基本的raspbain系统,接下来我们可以用xrdp或者vnc在Windows上远程连接树莓派. 一.安装xrdp xrdp和vnc是两种常见的远程桌面协议,可以进行可视化界面远 ...
- You Are the One HDU - 4283 (区间DP)
Problem Description The TV shows such as You Are the One has been very popular. In order to meet the ...
- 在linux服务器上搭建nvidia-docker环境
docker相当于一个容器,其可以根据你所需要的运行环境构建相应的运行环境,此时各个环境之间彼此隔离,就不会存在在需要跑一个新的代码的时候破坏原来跑的代码所需要的环境,各个环境之间彼此隔离开,好像一个 ...
- Linux记录-GC值
jmap -heap pid 查看gc情况: jstat -gc PID 刷新频率 jstat -gc 12538 5000 导出堆内存dump 文件: jmap -dump:file=文件名.bin ...