在栏目页列表中如何调用这个头像
   
lan988 级别:管理员    + 关注TA 支持(0) | 反对(0)原内容


在内容页中调用本内容发布者的头像是这样写的:select top 1 KS_User.userface FROM (KS_User INNER JOIN KS_ItemInfo ON KS_User.UserName = KS_ItemInfo.Inputer) INNER JOIN KS_U_gyzx ON KS_ItemInfo.InfoID = KS_U_gyzx.ID where KS_ItemInfo.infoid={$CurrInfoID} and KS_ItemInfo.channelid={$CurrChannelID}

但是现在我想在栏目中的列表项中,也调用这个头像,在列中每个头像跟在这个内容标题的后面,也就是随时标题,如何写?望 高手指点

,谢 谢了!

select top 1 KS_User.userface FROM (KS_User INNER JOIN KS_ItemInfo ON KS_User.UserName = KS_ItemInfo.Inputer) INNER JOIN KS_U_gyzx ON KS_ItemInfo.InfoID = KS_U_gyzx.ID where KS_ItemInfo.infoid={$CurrInfoID} and KS_ItemInfo.channelid={$CurrChannelID}

KS_ItemInfo表字段是KS_U_gyzx表子集,若在内容页调用,这个SQL冗余的,效率不高,可改成这样

  1. Select UserFace From KS_User Where Username=(Select Inputer From KS_U_gyzx Where ID={$Currinfoid})



栏目页可这样:

  1. Select ID,Title,UserFace From KS_U_gyzx A Left Join KS_User B On A.Inputer=B.Username Where Tid In({$currclasschildid}) And verific=1 And deltf=0 Order By ID Desc



写法类似上面那样  具体没测试    可实地测试下看看

回到顶部顶端 回到底部底部