Jump to content

Simple help


xero.03

Recommended Posts

[code]SELECT @frm_id:=b.fid as forum_id, a.fid as cat_id, b.ftitle as forum_title, b.fdesc as forum_desc, b.fmodid as forum_mods, c.poid as lp_id,
c.ponode as lp_node, c.potitle as lp_title, d.uid as lp_posterid, d.username as lp_poster, c.podate as lp_postdate FROM pre_forums a INNER JOIN
pre_forums b ON (a.fid=b.fparent AND a.fparent=0) INNER JOIN pre_posts c ON (c.poforum=b.fid AND c.podate=(SELECT MAX(podate) FROM pre_posts
WHERE poforum=@frm_id)) INNER JOIN pre_users d ON d.uid=c.poposter[/code]

Basically the variable declared in the beginning isn't being passed on to my sub-query in "pre_posts c", is there another way to pass that value or should I just call the last post data with each forum (in that case for each forum my query number will increase creating slightly more overhead, which chouldn't be too bad but I'm looking to avoid that)

EDIT: After alittle consideration it may be better to use a left join (since the forum might not always have posts) but either way my original request is still the same.
Link to comment
https://forums.phpfreaks.com/topic/24011-simple-help/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.