sql_base: select a.name,(select name from E e where e.id=1), c.name from A
left join D d on d.a_id=a.id
left join E e on e.id = a.e_id
left join C c on c.a_id=a.id
where 1=1
and a.id=1 and a.g_id=1 and e.id=1
先在需求是: E 和 C 的值传过来多个,
E1 C1
E2 C2
… …
结果想 name e1 c1
name e1 c2
name e1 c3 …
name e2 c1
name e2 c2
name e3 c1
name e3 c2
……
e.id=1 要和 下面的 e 值同步
left join D d on d.a_id=a.id
left join E e on e.id = a.e_id
left join C c on c.a_id=a.id
where 1=1
and a.id=1 and a.g_id=1 and e.id=1
先在需求是: E 和 C 的值传过来多个,
E1 C1
E2 C2
… …
结果想 name e1 c1
name e1 c2
name e1 c3 …
name e2 c1
name e2 c2
name e3 c1
name e3 c2
……
e.id=1 要和 下面的 e 值同步
解决方案 »
- 求砖石 mysql备份方案 大量数据备份 数据上百G
- mysql存储过程中两个CURSOR嵌套使用遇到的问题
- 怎么样获得group by的结果?
- 执行了一个比较简单Mysql子查询,但是速度很慢,请各位高手帮忙看看问题所在和提供解决方法.
- 跟ASP.NET相连的 连接块作为类库 但是多刷新会出现这个错误
- 如何判断启动哪个Mysql?分一直加!问题一个接一个
- 请问如何在MySQL中安装JDBC驱动程序?在哪里下载驱动程序??
- mysql本地数据库和远程数据库的同步问题
- mysql服务已经开了,但是项目一直连接不到本地服务器,求助
- mysql函数无法获取返回值
- 有关光标的问题 !求助!!!
- MYSQL:如何将数组添加到表中?
left join D d on d.a_id=a.id
left join E e on e.id = a.e_id
left join C c on c.a_id=a.id
where 1=1
and a.id=1 and a.g_id=1 and e.id in(你的多个E值)
贴建表及插入记录的SQL,及要求结果出来看看
建议你列出你的表结构,并提供测试数据以及基于这些测试数据的所对应正确结果。
参考一下这个贴子的提问方式http://topic.csdn.net/u/20091130/20/8343ee6a-417c-4c2d-9415-fa46604a00cf.html
1. 你的 create table xxx .. 语句
2. 你的 insert into xxx ... 语句
3. 结果是什么样,(并给以简单的算法描述)
4. 你用的数据库名称和版本(经常有人在MS SQL server版问 MySQL)
这样想帮你的人可以直接搭建和你相同的环境,并在给出方案前进行测试,避免文字描述理解上的误差。
left join D d on d.a_id=a.id
left join E e on e.id = a.e_id
left join C c on c.a_id=a.id
where 1=1
and a.id=1 and a.g_id=1 and e.id=1
e的值总是显示第一个……(该死的项目也不知我是第几个接的了,哎!)