CodeIgniter Forums
SQL select from two tables loop - 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: SQL select from two tables loop (/showthread.php?tid=41446)



SQL select from two tables loop - El Forum - 05-08-2011

[eluser]Unknown[/eluser]
Hello,
I am having trouble with pulling out some data from two tables.
The logic is to pull out all users and firm names that are added for that user.
It should show the results like this:

User1
-firm1
-firm2
-firm3

User2
-no firms added

User3
-firm1
-firm2

Hope you understand me, the key is showing all users with the firms added.
I tried with join but then it doesn't show the users which haven't added firm.
Thank you!


SQL select from two tables loop - El Forum - 05-08-2011

[eluser]Nick_MyShuitings[/eluser]
Left Join, not Inner Join... problem solved.