create view category_pc as
select c.category_id p_id, cp.parent_id c_id, c.from
from category c, category_parent cp
where c.category_id = cp.category_id && c.type='p' && ((c.from >= '".$sel_date_from."' && c.from <='".$sel_date_to."')
继续找父亲,又生成一个临时表
create view category_pcs as
select c_pc.p_id, c_pc.c_id, cp.parent_id s_id, c_pc.from, c.name s_name
from category_pc c_pc, category_parent cp, category c
where c_pc.c_id=cp.category_id && cp.parent_id=c.category_id";
继续找父亲,又生成一个临时表
create view category_pcsb as
select c_pcs.p_id, c_pcs.c_id, c_pcs.s_id, cp.parent_id b_id, c_pcs.s_name, c_pcs.from, c.name b_name
from category_pcs c_pcs, category_parent cp, category c
where c_pcs.s_id=cp.category_id && cp.parent_id=c.category_id";
解决方案 »
- mysql出错,求原理
- MYSQL中,对照B表和A表内容,生成C表.C表中还需要按照一定对应关系来生成新字段.最好不要用过程.
- 快速删除重复记录
- MYSQL同步问题,卡死在这里了[93全分送出]
- 请问这个sql语句是什么意思啊
- mysql连接不上,在phpmyAdmin下却可以连接并且管理
- mysqldump导出的insert语句过长
- 想结贴,,,问题没解决,,帮忙看一下
- 郁闷啊郁闷, mysql数据库的或者是php程序的问题,搞不清啊。。。
- 紧急求助JB+MYSQL问题!请高手赐教
- 帮忙分析下这个mysql分页的效率怎样?
- 用mysqltuner-perl来得到的报告,第一次用,不知道如何看,大家给点建议吧!
'截至2011-03-01 20:04:44 未结帖:14 当您的问题得到解答后请及时结贴.
http://topic.csdn.net/u/20090501/15/7548d251-aec2-4975-a9bf-ca09a5551ba5.html
http://topic.csdn.net/u/20100428/09/BC9E0908-F250-42A6-8765-B50A82FE186A.html
http://topic.csdn.net/u/20100626/09/f35a4763-4b59-49c3-8061-d48fdbc29561.html8、如何给分和结贴?
http://community.csdn.net/Help/HelpCenter.htm#结帖
1 SIMPLE cp index PRIMARY PRIMARY 8 NULL 313984 Using index
1 SIMPLE c eq_ref PRIMARY,c_category_id_from,c_from PRIMARY 4 stylife.cp.category_id 1 Using where