What is the best way of formulating a query which attempts to select two
distinct columns -
For example, the desired query is -
SELECT DISTINCT PF.PRODUCT_FEATURE_TYPE_ID, PF.PRODUCT_FEATURE_CATEGORY_ID
FROM PRODUCT_FEATURE PF
The closest which can be achieved is
SELECT DISTINCT (PF.PRODUCT_FEATURE_TYPE_ID, PF.PRODUCT_FEATURE_CATEGORY_ID)
FROM PRODUCT_FEATURE PF
this generated query is not acceptable in MySQL but works fine in PostgreSQL
and its generated with this view definition -
<view-entity entity-name="ProductFeatureView" package-name="mypackage">
<member-entity entity-alias="PF" entity-name="ProductFeature"/>
<alias name="productFeatureTypeAndCategory" entity-alias="PF">
<complex-alias operator=",">
<complex-alias-field entity-alias="PF"
field="productFeatureTypeId"/>
<complex-alias-field entity-alias="PF"
field="productFeatureCategoryId"/>
</complex-alias>
</alias>
</view-entity>
I'm using OFBiz trunk and using delegator.find(...) and
delegator.findCountByCondition(...) because the latter does not allow
supplying columns to be selected.
Thanks,
--
View this message in context:
http://ofbiz.135035.n4.nabble.com/Selecting-distinct-columns-tp4640610.html
Sent from the OFBiz - User mailing list archive at Nabble.com.