Reorder Field Names?

Ken Ray kray at sonsothunder.com
Tue Jun 3 09:39:57 CDT 2003


> > Ruslan, my guess is that Ken wants more direct matching between the 
> > fields and the way he displays them (particularly when using * in 
> > SQL).
> 
> I also think so. But usually DBs do not allow this.

Thanks Ruslan, Robert. The main reason I was doing this is that I worked
around an issue where I have two tables (Entities and Phones) and I want
to retrieve the data so I can display fields of data from the Entities
table and multiple phone numbers *side-by-side* in my display (which I
posted to the list a while back). Effectively, retrieving multiple
records from the Phones table and a single record from the Entities
table, and then putting the two together. So for example, if I had 3
phone numbers, I would get "my" Entity record and the 3 related Phone
records and put them together so it looked something like this:

  First, Last, Company, Phone1, PhoneLabel1, Phone2, PhoneLabel2,
Phone3, PhoneLabel3

This couldn't work with a single SQL query (and postprocessing was too
slow), so I "flattened" the Phones table so that there were fields for
each possible phone number - where the original table had 4 fields
(prefix, number, extension, type), the new table has 40 (so it can
support 10 phone numbers) with a field order of
"prefix1,number1,extension1,type1,prefix2,number2,..." etc. It was very
easy for me to then do a * query to the Phones table and loop through
each "set" of 4 fields to retrieve phone data. The problem is that now I
need to add a 5th field to each phone number, and I was hoping to not
have to redefine the field order by hand. But it looks like I'm going to
have to (unless Robert's XML dump idea can work for me). I'm at a very
early stage in the project, so I can redefine the data structure any way
I need to and re-import my testing data to accommodate the new structure
(so I don't have to worry about existing data in the system).

Thanks for your help - I'll let you know how it goes.

Ken Ray
Sons of Thunder Software
Email: kray at sonsothunder.com
Web Site: http://www.sonsothunder.com/ 




More information about the Valentina mailing list