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
Title:
Help with SQL Select clause...
Environment versions
Visual FoxPro:
VFP 9 SP1
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01181103
Message ID:
01181103
Views:
58
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
Why do programs stop working correctly as soon as you leave the Fox?
Next
Reply
Map
View

Click here to load this message in the networking platform