This query gives me multiple hits because of each assetid
may contain many vb.title
. How can I limit the result to only 1 hit for each assetid
?
'select DISTINCT v.id,
v.purchasedate,
v.customerid,
v.assetid,
va.description,
vb.title
from purchases v,
asset va,
assetdescription vb
where customerid = '$kid'
and v.assetid = va.id
and vb.assetid = va.id
order by v.purchasedate'
Best Answer
If you don't care which you get, you can use something like this:
If you want e.g. the "latest", then you can use something like this:
The decision which one to take is controlled by the ordering inside the window definition (
partion by v.assetid order by ....
)