[eluser]Tom Vogt[/eluser]
Hm, I still have this problem, with the added information that items belonging to user A can be at locations belonging to user B, which is why the first posted solution won't work.
[quote author="Tom Vogt" date="1279059516"]I'm looking for a way to access multiple relationships.
Here's my problem:
I have users, assets and items.
A user has many assets and many items.
An asset belongs to one user, and can contain many items.
Every item belongs to one asset and one user.
I want to find the items belonging to a specific user and a specific asset. Or, in other words, my SQL query would be:
Code:
select * from items where user_id=123 and asset_id=456
For added complexity, I only know the user via the asset, so I'm processing assets, and the user is $asset->user.
[/quote]
so $asset->user gives me the user of this asset. What I want is all the items of this user located at this asset. However, there can be other items of other users here as well, I don't want them.