Hello everyone,

I've been working with Zend for quite some time now but I'm still not all
too comfortable with Database-Models/Mappers.

To understand my problem you'll need the database layout, this can be found
with the following link:
https://docs.google.com/viewer?a=v&pid=explorer&chrome=true&srcid=0Bw9n6bLWBWK7MzYyODRkNzctZjRjMy00ODEzLTk0MzAtMzJjNzY4ZTNjZDRj&hl=en_US&authkey=CMvDtpUN

Then i have the following in my Zend Application:
http://pastebin.com/K9CpSSdE

I'm going after fetchRelevantForUser()

The query returned by this is:
SELECT DISTINCT `reports`.*, `groupimpact`.*, `usergroups`.*, `ingroup`.*,
`users`.* 
FROM `reports` 
INNER JOIN `groupimpact` ON groupimpact_reports_id = reports_id 
INNER JOIN `usergroups` ON usergroups_id = groupimpact_usergroups_id 
INNER JOIN `ingroup` ON ingroup_usergroups_id = usergroups_id 
INNER JOIN `users` ON users_id = ingroup_users_id WHERE (users_id = 1)

And that shouldn't be. As this returns way too many results obviously. I
only need the distinct of reports.*

STILL:
With that query, my application returns the following rows:
Test 1 (four times)
Test 2 (four times)
Test 3 (two times)

The same Query in HeidSQL (or any other SQL Editor) returns
Test 1 (two times)
Test 2 (two times)
Test 3 (one time)
and this would be correct


So i'm clearly missing some parts of parameters here that I won't see..

ANY help - and be it just links i haven't written carefully enough :D - is
greatly appreciated!

Thanks in advance

Sam

--
View this message in context: 
http://zend-framework-community.634137.n4.nabble.com/Zend-Db-Table-join-distinct-too-many-duplicate-results-tp3585024p3585024.html
Sent from the Zend Framework mailing list archive at Nabble.com.

-- 
List: [email protected]
Info: http://framework.zend.com/archives
Unsubscribe: [email protected]


Reply via email to