"select distinct ...."

2011/4/16 Waqar Sadiq <[email protected]>:
> Oskar,
>
> Object model is very simple in this case but I don't have all the
> attributes with me at this time.  However, thsi particular is only
> over one table and the first 5 attributes I mentioned in my email are
> the searchable attributes.  This is for a retail application where
> this table containes the entire data for a transaction and its line
> items.  The domain itself has hundreds of objects but what I show here
> is a flattened table for archived transactions.   As you can probably
> sense from the abobe table, this flattened table has data combined for
> the transaction header and its line items.  While in the online
> database, we have transactions header broken out from the line items,
> this archive table is flattened.
>
> My challenge is to be able to query this archived table to extract
> just the header information from this table based on soem of the
> header attributes.  That is why if there are 4 line items for a
> transaction, there will be 4 rows in thsi table but the header part of
> those 4 rows is common.  So I just want the first row so that I can
> extrtact the header part.  In the above case, I have data for 3
> transactions so I want 3 rows back.  What I tryign to get back is
> somehow get rows only distinct rows on the first 5 columns.
>
> I hope that helps.
>
> Thanks,
>
> On Apr 16, 10:29 am, Oskar Berggren <[email protected]> wrote:
>> What is your object model?
>>
>> 2011/4/16 Waqar Sadiq <[email protected]>:
>>
>>
>>
>> > I have a the following table with the data
>>
>> > TxnId     StoreId      ReceiptId     RegisterId
>> > Date                 LineItem      Amount      .....
>> > 123          345          678              399
>> > 4/16/2011            1              200
>> > 123          345          678              399
>> > 4/16/2011            2              150
>> > 123          345          678              399
>> > 4/16/2011            3              90
>> > 124          345          679              399
>> > 4/16/2011            1              200
>> > 124          345          679              399
>> > 4/16/2011            2              200
>> > 125          345          680              399
>> > 4/16/2011            1              200
>> > 125          345          680              399
>> > 4/16/2011            2              200
>> > 125          345          680              399
>> > 4/16/2011            3              200
>>
>> > In thism TxnId, Storeid, ReceiptId, RegisterId and Date fields form
>> > the properties that I could be searching for but I do not always have
>> > the all the fields all the time.  Let us I have only the Date
>> > available in a particular case.  If I query  where Date = 4/16/2011, I
>> > will get 9 rows.  I only want 3 rows, because I only want disticnt
>> > rows based on the the first 5 fields.
>>
>> > Can somebody help me with what my HQL needs to look like?
>>
>> > Thanks in advance.
>>
>> > Waqar
>>
>> > --
>> > 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 
>> > athttp://groups.google.com/group/nhusers?hl=en.- Hide quoted text -
>>
>> - Show quoted text -
>
> --
> 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.
>
>

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