Make sure you include all the PK fields of the tables in your join clauses. Otherwise you end up with records being mentioned twice in the result set. Pretty sure that causes it.
SO give us some more info on the tables and we might be able to help you out a bit more ... and readable code snippets might also work in your advantage
Try:
Code:
SELECT p.*
, a.id AS agentid
, a.name AS agent
, a.user AS user
, c.name AS company
, c.id AS companyid
, t.name AS type
, p.type AS typeid
FROM #__hp_companies AS c
, ((((#__hp_properties AS p INNER JOIN #__hp_agents AS a ON p.agent = a.id)
INNER JOIN #__hp_prop_types AS t ON p.type = t.id)
INNER JOIN #__hp_properties2 AS p2 ON p.id=p2.property)
INNER JOIN #__hp_featured AS f ON p2.property=f.property )
INNER JOIN #__hp_prop_ef as ef ON p2.field=ef.id
WHERE p.published='1'
AND p.approved='1'
AND t.published='1'
AND (publish_up = '0000-00-00 00:00:00'
OR publish_up <= NOW())
AND (publish_down = '0000-00-00 00:00:00'
OR publish_down >= NOW())
...
Also there is a bit of PHP code at the end of the SQL statement, I did not include it here. But try to write 'steady SQL code' that is not altered by PHP or whatever. Makes life a lot easier. There are other ways to solve the dependencies of the SQL statements. That will look a lot more tempting to a DB specialist ...
Gr,
Yveau