DISTINCT and API

Ruslan Zasukhin sunshine at public.kherson.ua
Thu Feb 17 16:21:23 CST 2005


On 2/17/05 3:54 PM, "Olivier" <vidal_olivier at yahoo.fr> wrote:

> Hi Ruslan and list,
> 
> It is not of equivalent of SQL function "DISTINCT" in the API methods.
> It is nevertheless useful.
> 
> For example, I have a city table.
> Certain cities have the SAME name.
> But I shall like having a city list WITHOUT doubloons.
> 
> If I use the API + RB methods to make it, I think that it will be
> slower than in SQL.

I will NOT agree Oliver with you that you need distinct in this task!
 
Assume in France exists "Paris".
And in the USA exists some city with name "Paris".

You want tell me that you want to see only once "Paris" ?
This is 2 real world objects. Different objects.

--------------------
In SQL we need distinct mainly because of next reason

    * JOIN of 1 : M tables for left table produce the same value
        to be repeated many times.

    * to remove duplicates we need DISTINCT.


-------------------
Well, in C++ we have tool for this: IndirectTable.

But Hmm, not sure if we can open this easy to V4RB.
I need to check...
may be this is only one factory method...

    dim CityDist as VTable

    CityDist = CreateIndirectTable(
                    "distCities",   // name of new table
                    "cities",       // original table
                    Array( "city" ) // fields to select
                    distinct
                )

As result you get something that works as table,
It have one field only. It have no duplicates.
It is not on disk, in RAM.


----------------------------
Another way that come to mind:
    
      UniqueCitiesSet = fldCityname.FindDistincts()

So you get set that point only on unique names.


-- 
Best regards,
Ruslan Zasukhin      [ I feel the need...the need for speed ]
-------------------------------------------------------------
e-mail: ruslan at paradigmasoft.com
web: http://www.paradigmasoft.com

To subscribe to the Valentina mail list go to:
http://lists.macserve.net/mailman/listinfo/valentina
-------------------------------------------------------------




More information about the Valentina-beta mailing list