PHP的mysql语句
基于ThinkPHP框架上的一条这样的语句$voList=$pairing->query("selecte.id,c1.nameasbname,c2.nameascnam...
基于ThinkPHP框架上的一条这样的语句
$voList = $pairing->query("select e.id,c1.name as bname,c2.name as cname from mmo_lmessage c1,mmo_lmessage c2,mmo_pairing e where c1.id=e.itemid and c2.id=e.pairid and type=1");
谁帮我转换为Join的语句 谢谢!
或是该如何使用Page分页 展开
$voList = $pairing->query("select e.id,c1.name as bname,c2.name as cname from mmo_lmessage c1,mmo_lmessage c2,mmo_pairing e where c1.id=e.itemid and c2.id=e.pairid and type=1");
谁帮我转换为Join的语句 谢谢!
或是该如何使用Page分页 展开
2个回答
展开全部
$sql = "select e.id,c1.name as bname,c2.name as cname from mmo_lmessage c1,mmo_lmessage c2,mmo_pairing e where c1.id=e.itemid and c2.id=e.pairid and type=1";
$sql = $sql." LIMIT $p->firstRow".",$p->listRows";
$voList = $pairing->query($sql);
这样就能分页了
$sql = $sql." LIMIT $p->firstRow".",$p->listRows";
$voList = $pairing->query($sql);
这样就能分页了
展开全部
$sql="select e.id,c1.name as bname,c2.name as cname from mmo_lmessage c1,mmo_lmessage c2,mmo_pairing e where c1.id=e.itemid and c2.id=e.pairid and type=1";//原SQL你这type是那个表里的啊?
//改进版的是代码如下
$sql="select e.id,c1.name as bname,c2.name as cname from mmo_lmessage c1 left join mmo_lmessage c2 on c1.id=e.itemid left join mmo_pairing e on and c2.id=e.pairid and type=1";//这里的type你自己选择表名吧
//改进版的是代码如下
$sql="select e.id,c1.name as bname,c2.name as cname from mmo_lmessage c1 left join mmo_lmessage c2 on c1.id=e.itemid left join mmo_pairing e on and c2.id=e.pairid and type=1";//这里的type你自己选择表名吧
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询