Im having a small problem using GROUP BY basically this is what i want to do:
My two tables:
ID PropertyNum PictureUrl
1 1 ../../media/images/the villa/image1.jpg
2 1 ../../media/images/the villa/image2.jpg
3 2 ../../media/images/tester/oakVilla.jpg
PropertyId Name
1 The Villa
2 Tester Villa
I want to select a property each only once and one picture for it, so i use this query:
<xsql:query>
SELECT dbPropertyId, dbName, dbPropertyNum, dbPictureUrl
FROM property, pictures
GROUP BY dbPropertyId
</xsql:query>
The problem is that the group by does not work " ORA-00979: not a GROUP BY expression "
But if i remove the GROUP BY then the query returns property 1 two times as there are two pictures. I have tried using distinct also but that does not work as the pictureURLs are distinct
Does anyone have an idea how to get around this problem?