CodeIgniter Forums
2 table results inside a single model function - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21)
+--- Thread: 2 table results inside a single model function (/showthread.php?tid=25281)



2 table results inside a single model function - El Forum - 12-07-2009

[eluser]max123[/eluser]
Is it possible to return 2 query results in a single model function. That means i want to take 2 result sets from 2 related tables by using a single model function. Is it possible?


2 table results inside a single model function - El Forum - 12-07-2009

[eluser]imn.codeartist[/eluser]
store each query result in the array and return it as combined result


2 table results inside a single model function - El Forum - 12-07-2009

[eluser]rogierb[/eluser]
Or use the sql UNION operator to combine two queries

see http://www.w3schools.com/sql/sql_union.asp for more info.