Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Cross Tables and syntax sql
Message
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00950444
Message ID:
00950661
Views:
9
Boris,

I received this solution From Anders.

I must try but it seems good....

Good evening

bernhart
CREATE CURSOR Calandier (date D)
FOR i = 1 TO 35
 INSERT INTO Calendrier VALUES (DATE(2004,9,27)+M.i)
NEXT

SELECT E.cnom, LEFT(CDOW(C.date),2)+' '+TRANSFORM(C.DAY(date))
.SUM(H.nheures1 ) ;
    FROM Employe E C LEFT JOIN Horaire H ON H.iid=E.iid
    RIGHT JOIN Calendrier C ON C.date=H.ddate ;
   WHERE MONTH(C.date)=10
    GROUP BY 1.2 ;
    ORDER BY 1,2 ;
INTO CURSOR Q1
DO (_genxtab) WITH 'TC1'

SELECT E.cnom, LEFT(CDOW(C.date),2)+' '+TRANSFORM(C.DAY(date))
.SUM(H.nheures2 ) ;
    FROM Employe E C LEFT JOIN Horaire H ON H.iid=E.iid
    RIGHT JOIN Calendrier C ON C.date=H.ddate ;
   WHERE MONTH(C.date)=10
    GROUP BY 1.2 ;
    ORDER BY 1,2 ;
INTO CURSOR Q1
DO (_genxtab) WITH 'TC2'

SELECT E.cnom, LEFT(CDOW(C.date),2)+' '+TRANSFORM(C.DAY(date)) . Max(ctaux)
;
    FROM Employe E C LEFT JOIN Horaire H ON H.iid=E.iid
    RIGHT JOIN Calendrier C ON C.date=H.ddate ;
   WHERE MONTH(C.date)=10 && AND E.iid=nnn
    GROUP BY 1.2 ;
    ORDER BY 1,2 ;
INTO CURSOR Q1
DO (_genxtab) WITH 'TC3'

SELECT 1, * FROM TC1 ;
UNION ALL SELECT 2, * FROM TC2 ;
UNION ALL SELECT 3, * FROM TC3 ;
ORDER BY 2, 1 ;
INTO CURSOR Tablecroise
>
>SELECT DDate,;
>       Employer.Cnom AS Employer,;
>       Pause.cNom    AS Pause,;
>       (nheures1+nheures2) AS SumHeures,;
>    FROM Horaire;
>    LEFT JOIN Employe ON Horaire.iemployeeid = Employe.Iid;
>    LEFT JOIN Pause   ON Horaire.iPauseId    = Pause.Iid;
>    GROUP BY Horaire.DDate, Horaire.iEmployeId, Horaire.iPauseId, 2,3
>    WHERE Horaire.iPauseId # 0;
>    INTO CURSOR cAll
>
>Is this Works for You?
>
>>1 2 3 4 5 ..............................31
>>
>>LEJEUNE SANDRINE B B B
>> 7.5 7.5 7.5
>>
>>
>>
>>( B is the Name of the pause )
>>7.5 is the sum( nheures1 + nheures2 )
>>
>>
>>
>>Thank boris
>>
>>bernhart
>>
>>
>>>My French is not too fluent (AT ALL) :o)))
>>>
>>>From that diagram, what data You need? Let's say for LEJEUNE Sandrine.
>>>
>>>
>>>>Hi Borislav,
>>>>
>>>>I should like something taht http://www.amline.be/Horaire.jpg
>>>>
>>>>
>>>>bernhart
>>>>
>>>>
>>>>
>>>>
>>>>>Hi Bernhart,
>>>>>Did every record in Horaire.dbf has iPauseID, or only some records have? What You need to select, only these records that have iPauseId or All records per day per employe?
>>>>>
>>>>>1. All records have iPauseId, records are grouped per day, per employer & iPauseId
>>>>>
>>>>> SELECT DDate,;
>>>>>        Employer.Cnom AS Employer,;
>>>>>        Pause.cNom    AS Pause,;
>>>>>        SUM(nheures1) AS SumHeures1,;
>>>>>        SUM(nheures2) AS SumHeures2;
>>>>> FROM Horaire;
>>>>> LEFT JOIN Employe ON Horaire.iemployeeid = Employe.Iid;
>>>>> LEFT JOIN Pause   ON Horaire.iPauseId    = Pause.Iid;
>>>>> GROUP BY Horaire.DDate, Horaire.iEmployeId, Horaire.iPauseId, 2,3
>>>>> INTO CURSOR cAll
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>>Horaire.dbf
>>>>>>iid i
>>>>>>ddate d
>>>>>>iemployeeid i
>>>>>>ipauseId i
>>>>>>nheures1 n(7,3)
>>>>>>cTaux1 c(3)
>>>>>>nheures2 n(7,3)
>>>>>>cTaux2 c(3)
>>>>>
>>>>>
>>>>>>1) the name of Pause.cnom
>>>>>>
>>>>>>2) The SUM( nHeures1 )
>>>>>>3) The SUM ( nHeures2 )
>>>>>
>>>>>
>>>>>>Bonjour à tous(tes),
>>>>>>Hi all,
>>>>>>
>>>>>>We Have :
>>>>>>
>>>>>>Employe.dbf
>>>>>>Cnom c(30)
>>>>>>iid i
>>>>>>
>>>>>>Horaire.dbf
>>>>>>iid i
>>>>>>ddate d
>>>>>>iemployeeid i
>>>>>>ipauseId i
>>>>>>nheures1 n(7,3)
>>>>>>cTaux1 c(3)
>>>>>>nheures2 n(7,3)
>>>>>>cTaux2 c(3)
>>>>>>
>>>>>>Pause.dbf
>>>>>>cnom C(3)
>>>>>>iid i
>>>>>>
>>>>>>
>>>>>>We Wants a table ( or cursor ) with per day(horaire.iid ) and employee(iemployeid)
>>>>>>
>>>>>>1) the name of Pause.cnom
>>>>>>
>>>>>>2) The SUM( nHeures1 )
>>>>>>3) The SUM ( nHeures2 )
>>>>>>
>>>>>>How can i have that ?
>>>>>>
>>>>>>thank in advance
>>>>>>
>>>>>>Sorry for my poor English...
>>>>>>
>>>>>>
>>>>>>Bernhart
Previous
Reply
Map
View

Click here to load this message in the networking platform