私は 2 つのハード ナッツで頭を悩ませます。したがって、問題は互いにリンクされており、1 つのスレッドに投稿します。残念ながら、テスト例を提供することはできません。それでは…</p>
Joomla 2.5 テンプレートで次のクエリを使用します。
->select(array('a.description','a.display_name','a.parent_id','a.filename','a.url', 'b.title','b.alias', 'b.id','b.catid','b.state','c.title as catTitle','c.parent_id as catparent'))
->from('#__attachments AS a')
->join('LEFT', '#__content AS b ON (a.parent_id = b.id)')
->join('INNER', '#__categories AS c ON b.catid = c.id')
->where("b.state = 1 AND c.parent_id in (23)");
これにより、「#_ content」と「#_articles」を含むモジュール テーブル「#_ attachments」が結合されます。記事の添付画像、記事のタイトル、エイリアス、記事 ID、カテゴリ タイトル、カテゴリ ID を取得することを目的としています...
私の質問
このクエリは、記事のカテゴリの親カテゴリの ID ('c.parent_id as catparent') を取得します。この親カテゴリのタイトルも与えるサブセレクトを持つことは可能ですか (id は catparent にあります)?
したがって、私の場所に "in" n がある特別なサブカテゴリの記事のみが必要です。すべてのサブカテゴリが ID (5) の親カテゴリの子であることを認識します。cat 5 からサブカテゴリのすべての ID を取得する方法は?
敬具、
トニー