$this->query = 'SELECT p.*, p.id AS pid, "public" AS `type` FROM posts p WHERE p.user_id="'.$this->target_user->id.'" '. $this->filter->groups() .' AND p.api_id<>2 AND p.api_id<>6 '; $this->query_order = ' ORDER BY p.id DESC '; break;
"p" olarak kısalttığı tablo adı posts. Posts tablosunun attached sütunu "1" olan değerleri bu kod ile kolaylıkla çekebiliyorum. Bunun için ;
$this->query = 'SELECT p.*, p.id AS pid, "public" AS `type` FROM posts p WHERE p.user_id="'.$this->target_user->id.'" '. $this->filter->groups() .' AND p.api_id<>2 AND p.attached="1" AND p.api_id<>6 '; $this->query_order = ' ORDER BY p.id DESC '; break;sorgusunu kullanıyorum. Ancak benim istediğim ise posts tablosundan farklı olarak, "posts_attachments" tablosundaki aynı "post_id" ye sahip verinin "type" sütunundaki değerinin "image" olanlarını da filtre etmesi. posts_attachements tablosundaki post_id sütunu , posts tablosundaki id değeri olacak yani.
Yani Posts tablosunda attached="1" olacak aynı zamanda posts_attachments tablosunda type="image" olacak.