Jump to content

Seth^^

New Members
  • Posts

    2
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

Seth^^'s Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. never mind, i managed to do it on my own... hehe [code] SELECT l.*, COUNT(f.id) AS numfiles, c.numchildren FROM downloads AS l LEFT JOIN files AS f ON l.id=f.parent INNER JOIN     (     SELECT     l2.id AS parent, COUNT(c2.id) AS numchildren     FROM downloads AS l2     LEFT JOIN     downloads AS c2     ON l2.id=c2.parent     GROUP BY l2.id     ) AS c ON c.parent=l.id WHERE l.parent = '{$_GET['d']}' GROUP BY l.id ORDER BY l.name ASC [/code]
  2. Hello shoz, I have the same problem that Deville had. This is my query [code] SELECT l.id, l.parent, l.traceback, l.name, l.pic, l.description, l.d_lastupdated, COUNT(c.id) AS child, c.parent, COUNT(f.id) AS files, f.parent FROM downloads AS l LEFT JOIN downloads AS c ON c.parent = l.id LEFT JOIN files AS f ON f.parent = l.id WHERE l.parent = '{$_GET['d']}' GROUP BY l.id ORDER BY l.name ASC [/code] Can you please show me how the sub-query is made ? Thanks in advance
×
×
  • 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.