代码如下:
drop procedure if exists pro_list1;
delimiter //
create procedure pro_list1
(
in list_rid bigint(11)
)
begin
select a.eid, a.title as content,c.title as kit,
(
select group_concat(distinct a2.name)
from creator_locals as a2
join creator_contents as b2 on a2.eid = b2.creator_eid and a2.type = 'MAIN' and b2.role = 'OA'
where b2.content_eid = a.eid and a2.language = a.language
) as OA,
(
select group_concat(distinct a3.name)
from creator_locals as a3
join creator_contents as b3 on a3.eid = b3.creator_eid and a3.type = 'MAIN' and b3.role = 'OC'
where b3.content_eid = a.eid and a3.language = a.language
) as OC,
(
select group_concat(performer)
from performer_locals as a1
join performer_contents as b1 on a1.eid = b1.performer_eid and a1.type = 'MAIN'
where b1.content_eid = a.eid and a1.language = a.language
) as performer,
(
select group_concat(gender)
from performers as a1
join performer_contents as b1 on a1.eid = b1.performer_eid
where b1.content_eid = a.eid
) as performer_type,
c1.published,
(
select group_concat(distinct a2.name)
from meta_dictionary as a2
join content_meta_maps as b2 on a2.element_group = b2.relate_group and a2.element_code = b2.relate_code and a2.element_group = 'GENRE'
where b2.content_id = a.eid
) as genre
from content_locals as a
join contents as b on a.language = 'KR' and a.eid = b.eid and (b.mp3_id  is null or b.mp3_id = 0)
join kit_locals as c on b.kit_eid = c.eid and a.language = c.language
join kits as c1 on c.eid = c1.eid
join list_details as d
on a.eid=d.content_eid and d.list_rid=list_rid and d.content_eid is not null;
end
//
delimiter ;
set @list_rid=100;
call pro_list(@list_rid);我想实现通过改变list_rid的值,返回需要的数据,d.list_rid=list_rid ,这个意思就是在查询的时候必须要满足
list_details表的list_rid为我要查询的数值请假大家看看问题出在哪里

解决方案 »

  1.   

    建议你能简单描述一下你的问题。否则比较难猜。另外,变量名不要和字段名重复。把你的 in list_rid bigint(11) 改为 in $list_rid bigint(11) 试试
      

  2.   

    建议你能简单描述一下你的问题。否则比较难猜。另外,变量名不要和字段名重复。把你的 in list_rid bigint(11) 改为 in $list_rid bigint(11) 试试
      

  3.   

    谢谢ACMAIN,问题已经解决,是变量名的问题