aggregate

Proper reconstitution of Aggregate objects in the Repository?

Assuming that no ORM (e.g. Doctrine) is used inside the Repository, my question is what is the proper way of instantiating the Aggregate objects? Is it instantiating the child objects directly inside the Repository and just assign it to the Aggregate Root through its setters or the Aggregate Root is responsible of constructing its child ...

django aggregation with objects

model: class Product(models.Model): name = models.CharField(max_length = 128) (...) def __unicode__(self): return self.name class Receipt(models.Model): name = models.CharField(max_length=128) (...) components = models.ManyToManyField(Product, through='ReceiptComponent') def __unicode__(self): return self.nam...

News Aggregater of sorts

There is a website that my company uses that updates information about 3 specific things throughout the day. We use the information from 1 of them and what we are wanting to do is pull this information as it is added to their site and add it to a page of our own to view easier. Is this even possible? Can anyone point me in the direction ...

Objective C: CoreData and aggregation

Given a CoreData-Entity with an date (days) and an ammount called Transaction. Is it with CoreData possible (and how) to aggregate/group the 'table' (with all Transactions) by Date and calculate the sum of the day in a second column/attribute? (the SQL-Solution would be SELECT date, sum(ammount) FROM transaction GROUP BY date) ...

Aggregating and displaying content from hundreds of RSS feeds

I'd like to build a website that aggregates and displays content from hundreds of RSS feeds. The feeds will be from different sites: Twitter, Flickr, Tumblr, etc, so the content will be very heterogenous. In a perfect world — and this is more of a side issue — I would like to allow other people to help manage the list of feeds and assi...

Oracle aggregate function to return a random value for a group?

The standard SQL aggregate function max() will return the highest value in a group; min() will return the lowest. Is there an aggregate function in Oracle to return a random value from a group? Or some technique to achieve this? E.g., given the table foo: group_id value 1 1 1 5 1 9 2 2 2 4 2 8...

GROUPING DATEs in sql

i have a table in which there are ids and resigning dates. a singlle id have more than one resigning date. how can i display the table in which one id have only one resigning date which is the latest ie the maximum date. can somebody help me plzz....thanx a ton ...

Aggregate on dictionary question

I am using ASP.NET MVC2 and I would like to make up a url based on the current one in the address bar inside a HtmlHelper extension. So far I have this: url = helper.ViewContext.RequestContext.RouteData.Values .Aggregate<KeyValuePair<String, Object>>((w, next) => w + next); But that does not compile. Anyone has a good idea on h...

Aggregates and Value Objects: Delete?

Hi, I'm currently determining the entities, value objects and aggregates in a system. Say the following Entities have been identified: Customer, CustomerEmail, Email, CustomerAddress, Address, AddressType where Customers -> Emails is a many to many relationship, as is Customers -> Addresses (with an address type). These relationships ...

How to select a column value that corresponds to a row returned by a MySQL aggregate function?

I have a table like date user_id page_id 2010-06-19 16:00:00 1 4 2010-06-19 16:00:00 3 4 2010-06-20 07:10:00 1 1 2010-06-20 12:00:10 1 2 2010-06-20 12:00:10 1 3 2010-06-20 13:05:00 2 ...

How can I efficiently compute the MAX of one column, ordered by another column?

I have a table schema similar to the following (simplified): CREATE TABLE Transactions ( TransactionID int NOT NULL IDENTITY(1, 1) PRIMARY KEY CLUSTERED, CustomerID int NOT NULL, -- Foreign key, not shown TransactionDate datetime NOT NULL, ... ) CREATE INDEX IX_Transactions_Customer_Date ON Transactions (CustomerID, Tr...

How can I do this in SQL? I need to find possible permutations of a small table of data

Hi All, I have this small table of data. Dir LinkL LinkH East 19 27 East 27 29 East 29 31 West 46 49 West 49 51 West 51 61 These represent possible trips. How can I query this? For instance if you started at station 19, you could go from 19->27, 19->29, and 19->31. Three possible "trips" But starting from 2...

Can I use non-aggregate columns with group by?

You cannot (should not) put non-aggregates in the SELECT line of a GROUP BY query. I would however like access the one of the non-aggregates associated with the max. In plain english, I want a table with the oldest id of each kind. CREATE TABLE stuff ( id int, kind int, age int ); This query gives me the information I'm aft...

How to return additional fields based on aggregate function ?

I have two tables, jobcli client_id job_id jobs job_id jobTitle startDate projectmgr What I am having trouble with is to display client_id, job_id, jobTitle, startDate, and projectmgr in a query, where the results are grouped by client_id and have max of date. So far I can get a list that's groupped by client_id with their c...

Aggregation and extra values with Django

Hi, I have a model which looks like this: class MyModel(models.Model) value = models.DecimalField() date = models.DatetimeField() I'm doing this request: MyModel.objects.aggregate(Min("value")) and I'm getting the expected result: {"mymodel__min": the_actual_minimum_value} However, I can't figure out a way to get at the ...

Can this Mysql query be amended to display invoice only once for the same idinvoice

The query below SELECT <output name="c.name" title="Name" />, <output name="c.reference" title="Reference No." />, <output name="i.idinvoice" title="Invoice ID" />, <output replace="(SUM(v.quantity * s.charges))/COUNT(i.idinvoice)" />As Invoice <output replace="p.amount" />AS Amount, <output replace="p.idpayment" title="Payment ID" />, ...

showing non aggregate column in a group by query in SQL

Hello all i have a table in SQL 2008 as ID Items 1 A 1 B 2 C 3 D 3 B i would like to get the result as ID Items 1 A,B 2 C 3 B,D I have used cursors but it has considerably slowed the process , can i achieve the above result using group by query or through any other way. Thanks and R...

Sum TimeSpan array with a one-liner?

Is there a way to aggregate multiple aggregates to 1 time span? Dim times = { New TimeSpan(1, 0, 0), New TimeSpan(1, 10, 0), New TimeSpan(1, 50, 0), New TimeSpan(0, 20, 0), New TimeSpan(0, 10, 0) } Dim sum As New TimeSpan For Each ts In times sum = sum.Add(ts) Next 'That's what I desire: sum = times.Sum sum = times.Aggreg...

DDD: Address as an aggregate root?

I’m struggling designing this system where an address is the most central piece of information. Now in this case, an address is not just a few lines of strings. We’re storing municipalities (code, name), district (post code, name), streets (code, name), house number on a street in a specific district belonging to a municipal. It's a very...

relation between access specifiers and using initializer lists for POD types in c++0x.

take two following classes: class Test1{ public: Test1()=default; Test1(char in1,char in2):char1(in1),char2(in2){} char char1; char char2; }; class Test2{ public: Test2()=default; Test2(char in1,char in2):char1(in1),char2(in2){} private: char char1; char char2; }; I know in c++0x both of these classes are considered...