I'm looking for a way to merge blog article entries with social media entries (non craft table). The idea is to output both entry types together from the same array, this will allow me to order all entries by date.
The social media plugin that I have put together queries the non-craft social media table but I need a solution to UNION the two tables together.
How would I go about doing this within Craft?
My table structure for craft_archived_social_items
id
intunique_id
varchar(255) NOT NULL,account
varchar(255) NOT NULL,category
varchar(255) NOT NULL,title
text NOT NULL,content
text NOT NULL,image
varchar(255) NOT NULL,link
text NOT NULL,date
datetime NOT NULL,status
varchar(255) NOT NULL DEFAULT 'inactive',date_cached
datetime NOT NULL,PRIMARY KEY (
id
) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1;
My service file is currently using the db->createCommand
to query the table
$social_items = craft()->db->createCommand()
->select('title, content, date, category, id, account, unique_id, image, link')
->from('archived_social_items')
->offset($offset)
->limit($counter)
->order('date desc')
->queryAll();