[eluser]vtx220[/eluser]
I was wondering how I could use a union. Basically I want to display a list of articles from two database tables. Most columns are the same, the ones that are needed are definitively the same (id isn't needed).
Here's what I have: (note that SELECT * is for debugging)
Code:
function get_articlelist() {
$this->db->query(SELECT * FROM mk_education WHERE spotlight=1 UNION SELECT * FROM mk_entertainment WHERE spotlight=1)
$query = $this->db->get();
return $query;
}
Obviously this doesn't work so how can it work?
I'd also like to sort by time, descending and limit by 4. I've been at it for about 3-hours now and still no go haha