Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Help with SQL Select clause...
Message
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Environment versions
Visual FoxPro:
VFP 9 SP1
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01181103
Message ID:
01183245
Views:
16
What you are looking to get is almost like a cross-tab based on the date... By looking at the structures, I don't think it would work. Typically, you would be doing some sort of aggregate (ie: MIN(), MAX(), SUM(), AVG(), etc) on the columns you wanted -- such as by date, but there is no aggregation function I can think of that would do that with character strings. By default, character strings would get their initial length from first record defines the width of the column (unless you cast type as memo) and then, when you add to it wouldn't necessarily lengthen the string... but this DOES give me an idea...

>Bump
>
>>Fabio did help me once with something similar, but i can't seem to grab the logic in doing what i need here using pure SQL-SELECT statements...
>>
>>I have the following tables:
>>1) Table Employees: EmpID (I) PK, EmpName C(30)
>>2) Table Sched: SchedID(I) PK, EmpID(I), SchedTime (DT), Flight C(10)
>>In sched, i can have many flights for the same employee in the same day, or just one flight in a specific date.
>>I would like to crosstab the dates for a week to have the whole week in the header. For each cell in the generated matrix, i'd like to see the flight and the time ( just the time part of the datetime field, i.e ttoc(schedtime,2) )
>>I try to build the following result:
>>
>>Employee    Monday 1/1     Tuesday 2/1    Wednesday 3/1  Thurs 4/1 ...
>>---------------------------------------------------------------------
>>Jaime       BA123 10:00     BA123 10:00     BA123 10:30   LY111 16:30
>>            LY111 16:30                     LY111 16:30
>>
>>
>>I did this through a manual loop through the table, but i'd like to do it through SQL if possible, so any ideas will be greatly appreciated.
>>
>>In the meantime, a happy and productive new year to all
>>Jaime
Previous
Reply
Map
View

Click here to load this message in the networking platform