select a.etId, a.Name,bcodeCont,ccodeCont,dcodeCont,ecodeCont
from etInfo a,
(select group_concat(codeCont) as bcodeCont from codetable where codeId in (select areaId from arealink where etId in ('et001','et002'))) b,
(select group_concat(codeCont) as ccodeCont from codetable where codeId in (select busiProId from busiprolink where etId in ('et001','et002'))) c,
(select group_concat(codeCont) as dcodeCont from codetable where codeId in (select hotUseId from hotuselink where etId in ('et001','et002'))) d,
(select group_concat(codeCont) as ecodeCont from codetable where codeId in (select budgetId from budgetlink where etId in ('et001','et002'))) e
where a.etId in ('et001','et002')
----------------------------------------------------------
现在结果:
etId bcodeCont ccodeCont dcodeCont ecodeCont
etId001 中山区 烧烤,自助 随便吃吃,家庭聚餐 201-300,301-400
etId002 中山区 烧烤,自助 随便吃吃,家庭聚餐 201-300,301-400----------------------------------------------------------
想要结果:
etId bcodeCont ccodeCont dcodeCont ecodeCont
etId001 中山区 烧烤 随便吃吃 201-300
etId002 中山区 自助 家庭聚餐 301-400
from etInfo a,
(select group_concat(codeCont) as bcodeCont from codetable where codeId in (select areaId from arealink where etId in ('et001','et002'))) b,
(select group_concat(codeCont) as ccodeCont from codetable where codeId in (select busiProId from busiprolink where etId in ('et001','et002'))) c,
(select group_concat(codeCont) as dcodeCont from codetable where codeId in (select hotUseId from hotuselink where etId in ('et001','et002'))) d,
(select group_concat(codeCont) as ecodeCont from codetable where codeId in (select budgetId from budgetlink where etId in ('et001','et002'))) e
where a.etId in ('et001','et002')
----------------------------------------------------------
现在结果:
etId bcodeCont ccodeCont dcodeCont ecodeCont
etId001 中山区 烧烤,自助 随便吃吃,家庭聚餐 201-300,301-400
etId002 中山区 烧烤,自助 随便吃吃,家庭聚餐 201-300,301-400----------------------------------------------------------
想要结果:
etId bcodeCont ccodeCont dcodeCont ecodeCont
etId001 中山区 烧烤 随便吃吃 201-300
etId002 中山区 自助 家庭聚餐 301-400
解决方案 »
- 哪里下载Mysql SDK开发包
- LongText长度为什么最大只能设置为65535?
- 请问一个SQL语句统计对应多个记录,只选择其中一条记录的办法
- cppsqlite 为什么有Unable to close database
- linux安装mysql.....求救
- 我在虚拟主机上架设 phpmyadmin ,登录时报这个警告正常吗?
- mysql grant 授权不起作用
- postgresql中怎么检索最近时间内的20条记录呢
- 已安装了postgresql 7。3的linux用什么命令访问,查看另一台机器上的posgresql数据库?在线等待~~~~~~~~~
- MYSQL查询获取当前时间,一条记录减少一秒如何操作
- 如何用SQL语句得到本季度第一天的日期??
- MySql 插入数据 帮忙看一下方法有什么问题
from etInfo a,
(select group_concat(codeCont) as bcodeCont from codetable where codeId in (select areaId from arealink where etId in ('et001','et002'))) b,
(select group_concat(codeCont) as ccodeCont from codetable where codeId in (select busiProId from busiprolink where etId in ('et001','et002'))) c,
(select group_concat(codeCont) as dcodeCont from codetable where codeId in (select hotUseId from hotuselink where etId in ('et001','et002'))) d,
(select group_concat(codeCont) as ecodeCont from codetable where codeId in (select budgetId from budgetlink where etId in ('et001','et002'))) e
where a.etId in ('et001','et002')
我是MySQL数据库,instr是MySQL关键字吗?
但 a--e 同一次查询ID的都是一样的。
+--------------------+
| instr("abcde",'a') |
+--------------------+
| 1 |
+--------------------+
1 row in set (0.00 sec)mysql> select instr("abcde",'b');
+--------------------+
| instr("abcde",'b') |
+--------------------+
| 2 |
+--------------------+
1 row in set (0.00 sec)mysql> select instr("abcde",'v');
+--------------------+
| instr("abcde",'v') |
+--------------------+
| 0 |
+--------------------+
1 row in set (0.00 sec)mysql> select instr("abcde",'c');
+--------------------+
| instr("abcde",'c') |
+--------------------+
| 3 |
+--------------------+
1 row in set (0.02 sec)mysql> select instr("abcde",'d');
+--------------------+
| instr("abcde",'d') |
+--------------------+
| 4 |
+--------------------+
1 row in set (0.00 sec)
有QQ吗?给你发建表文。
这样其它人就可能在本机建立和你相同的测试环境了。
http://forum.csdn.net/PointForum/ui/scripts/csdn/Plugin/001/face/13.gif