i trying retrieve latest topic of subcategory. here sql:
select * threads left join subs on subs.category_id = threads.subcategory_id left join categories on categories.id = subs.category_id inner join ( select id, max(lastdate) lastdate threads group id ) b on subs.category_id = threads.subcategory_id , threads.lastdate = b.lastdate group subs.category_id, threads.subcategory_id, threads.lastdate desc
however, if trying make thread subcategory links category used twice, doesn't work.
maybe can me out.
subs in database: (as can see, of subcategories has same category_id
updated query. duplicate echo output each new category linked category used twice: http://joxi.ru/dmbjzq5c1ll0mp
Comments
Post a Comment