Adding Records at Start

Cindy Brown cindy at kowhaiprogramming.com
Thu Jan 8 12:48:10 CST 2004


What it looks like you need is to have all level_1 records with the same
name to have the same ID.

Level_1 Level_2        ID
Horse   Arab            2
Horse   Thoroughbred    2
Fish    Carp            1
Fish    Goldfish        1
Fish    Shark           1

Using SELECT DISTINCT Level_1 Order by ID

Will sort this out into two records with Fish first followed by Horse.

If you then want to sort Level_2 as well you would probably need to have a
secondary sort ID.

Hope that helps.

Cindy
  

>>> But you do something strange then.
>>> 
>>>  You have 10 records with the same value in level_1
>>>  You want DISTINCT them to produce just ONE record.
>>> 
>>>  Then it is not clear way to use 10 indexes in that 10 records.
>>>  You cannot guess which one index will be choosed.
>>>  You see?
>> 
>> Well, I'm usually doing something strange! What I am doing is building a
>> menu tree, with little folders and files, out of the database. The folders
>> are built from the entries in level_1. level_2 is the list of files that go
>> into the folders. There might be several files that go into each folder, so
>> their level_1 entry would be the same... folder1/file1, folder1/file2,
>> folder1/file3, folder2/file1, folder2/file2, etc. So, the reason I need a
>> unique list of level_1 is that I don't want to create a new and duplicate
>> folder for each and every file.
>> 
>> - Mark
> 
> I don't see this so strange, but what Cindy pointed out might be
> truly your problem. And it would be sort of catch 22. Normally,
> sorting requires all sort fields to be included in select but in your
> case this clashes with distinct (actually kills it, since field pairs
> will be always unique).
> 
> You may have to forgo the distinct and remove duplicates self or sort
> them self.
> 
> Robert
> _______________________________________________
> Valentina mailing list
> Valentina at lists.macserve.net
> http://lists.macserve.net/mailman/listinfo/valentina
> 
> 


-- 

Cindy Brown
Programmer
SchoolMaster

Kowhai Programming Systems
PO Box 198, Invercargill
81 Marama Avenue South, 9RD Invercargill
Phone (03) 213 1243
Fax (03) 213 1248
Mobile (021) 354 930
<http://www.kowhaiprogramming.com/>




More information about the Valentina mailing list