Can you give an example or link to example of this?

On Mon, Jul 6, 2009 at 4:28 PM, Tuna Toksoz<[email protected]> wrote:
> Correlated criteria's and subquery projection.
>
> Tuna Toksöz
> Eternal sunshine of the open source mind.
>
> http://devlicio.us/blogs/tuna_toksoz
> http://tunatoksoz.com
> http://twitter.com/tehlike
>
>
>
>
> On Mon, Jul 6, 2009 at 8:23 AM, zhibin <[email protected]> wrote:
>>
>> I have the following 2 classes:
>>
>> public abstract class AbstractProduct : Entity
>> {
>>        public virtual ISet<Price> Prices { get; set; }
>> }
>>
>> public class Price : Entity
>> {
>>        public virtual AbstractProduct AbstractProduct { get; set; }
>>        public virtual decimal Amount { get; set; }
>>        public virtual decimal Quantity { get; set; }
>>        public virtual DateTime? Expires {get; set;}
>> }
>>
>> I want to get products ordered by unit price.  The SQL I supposed is:
>>            select p0.*, (select min(pr.amount) from "Price" pr
>>                            where pr.abstractproduct_id=p0.id
>>                                and pr.Quantity = 1
>>                                and (pr.expires>'2009-7-1' or
>> pr.expires is null)
>>                            )as amount
>>            from "AbstractProduct" p0;
>>            order by amount;
>>
>> I tried it in Postgresql, it returns correct result. but I don't know
>> how to code it with the Criteria API.
>>
>> Can anybody help me?
>> Thanks!
>>
>
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/nhusers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to