ofbiz-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Varun Bhansaly <vbhans...@gmail.com>
Subject Re: Selecting distinct columns
Date Sat, 13 Apr 2013 01:23:35 GMT
A correction on the last portion - "I'm using OFBiz trunk and using
delegator.find(...) and
NOT using delegator.findCountByCondition(...) because the latter does not
allow supplying columns to be selected."


On Fri, Apr 12, 2013 at 5:40 PM, Varun Bhansaly <vbhansaly@gmail.com> wrote:

> 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.
>



-- 
Regards,
Varun Bhansaly

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message