7940 Posts in 1543 Topics by 946 members
|Go to End|
27 August 2012 at 10:10am
hope I can explain my problem clearly. Okay, I will try..
I have created a dataobject with data sets like this:
1. data set: name1 - adress1 - town1
2. data set: name2 - adress2 - town1
3. data set: name3 - adress3 - town2
4. data set: name4 - adress4 - town2
3. data set: name5 - adress5 - town3
You can see that different people are living in different towns.
Now I would like to know in which different towns the people are living.
The desired result should be: town1, town2 and town3
Any ideas? Thanks everybody for support,
27 August 2012 at 11:40am
If you start with a GROUP BY sql statement:
$sql = singleton('SomeObject')->buildSQL();
$sql->select = "town";
$result = $sql->groupby("town")->execute();
And then pass the result into a dataobject you can use:
$groupObject = singleton('SomeObject')->buildDataObjectSet($result);
Just return $groupObject and you can use it in your template.
27 August 2012 at 10:32pm
thank you so much. Your job works perfectly!
|Go to Top|