[eluser]Johan André[/eluser]
[quote author="BobbyB" date="1243010202"]Thanks again for your help.
But what if a user does not have any invoices yet?
I am also still getting double entries in the users array if a user has more than 1 invoice.
The closest I got was using the query in my first post.
But using "join" I always produce duplicate entires in my array(if a user has more than 1 invoice).
I will probably have to create a sub-array(as alejandra said) with all the invoices a user has and then check for due ones.
Kinda like this:
array(user1=>first_name=>last_name=>sub_array(invoices_user1=>invoice1=>invoice2))user2=>....
Any hints on how to do this?
Thanks in advance![/quote]
Try adding
Code:
$this->db->group_by('users.id');
in the query. That should give you one row per user, but only users having invoices that are past due...