Employee attendance query

I Have 3 tables
dbo.Emp_setting
name data type allownulls
Empset_id int Unchecked
personal_id int Unchecked
DesignationID int Checked
DivisionID int Checked
Emp_status char(1) Checked
Emp_TypeId int Checked
Dept_Id int Checked
Group_Id int Checked
NDIVGRP_CODE bigint Checked
dbo.tempDeviceLogs
name datatype allow nulls
LogsID int Unchecked
Device_Person_id int Unchecked
Device_id int Unchecked
logDateTime datetime Unchecked
logVerifyMode nchar(10) Unchecked
workCodeID int Unchecked
Machin_install_id int Unchecked
data_loaded_dt datetime Checked
Inout int Checked
dbo.persons_profile
[pesonal_id]
,[Emp_Code]
,[Title]
,[First_name]
,[Middle_name]
,[last_name]
,[Father_Husband_Name]
,[Dob]
,[Age]
,[gender]
,[Marital_status]
,[Nationality]
,[bloodGroup]
,[perAddress]
,[PerStreet]
,[PerLocation]
,[PerCity]
,[PerPincode]
,[CorAddress]
,[CorStreet]
,[CorLocation]
,[CorCity]
,[CorPincode]
,[LandlinePhone]
,[cellNo]
,[EmailId]
,[NosofDependendants]
,[Dependendants_details]
,[Emergency_FirstName]
,[Emergency_Middle_name]
,[Emergency_Last_name]
,[Emergency_WithRelation]
,[Emergency_PhoneNo]
,[Emergency_CellNo]
,[Emergency_emailId]
,[Office_PF_ac_no]
,[ESI_ac_no]
,[JoinedDate]
,[Photofile]
,[ReportTo]
,[Brief_Notes]
,[dateofTermination]
,[termination_note]
,[Print_Priority]
,[DeviceEmployeeID]
,[LogsPermitted]
,[Machin_install_id]
,[Designation]
,[Dept]
,[Section]
,[Groups]
,[EmpWorkingTypeT]
Expected output 
employeename device_person_id designation emptype Date status
STATUS is emp_status whether employee is present or absent for a specific day

in output if we enter todays date then it should show employee details with whether he is present for entered date or not.
in tempdevicelogs DEVICE_PERSON_ID and in Emp_setting PERSON_ID columns are equal
SELECT b.Device_Person_ID, a.Personal_id, Date1,
CASE WHEN b.Device_Person_id IS NOT NULL THEN 'A' ELSE 'P' END as Emp_Status
FROM Emp_setting a
LEFT OUTER JOIN (SELECT device_person_id, MAX(logDateTime) AS Date1 FROM tempDeviceLogs GROUP BY device_person_id) b
ON a.personal_id = b.device_person_id
with this code am getting output as
Device_Person_ID Personal_id Date1 Emp_Status
879 879 2014-05-23 13:06:23.000 A
92 92 2014-05-23 00:00:00.000 A
501 501 2014-05-23 00:00:00.000 A
971 971 2014-05-23 00:00:00.000 A
384 384 2014-05-23 09:11:54.000 A
802 802 2014-05-23 00:00:00.000 A
407 407 2014-05-23 14:52:13.000 A
762 762 2014-05-23 13:46:20.000 A
616 616 2014-05-24 00:00:00.000 A
487 487 2014-05-23 08:27:10.000 A
109 109 2014-05-23 00:00:00.000 A
650 650 2014-05-24 00:00:00.000 A
773 773 2014-05-23 06:03:40.000 A
556 556 2014-05-24 00:00:00.000 A
630 630 2014-05-23 00:00:00.000 A
530 530 2014-05-23 14:51:01.000 A
301 301 2014-05-24 00:00:00.000 A
387 387 2014-05-23 05:12:03.000 A
550 550 2014-05-23 00:00:00.000 A
942 942 2014-05-23 00:00:00.000 A
985 985 2014-05-23 00:00:00.000 A
95 95 2014-05-24 00:00:00.000 A
521 521 2014-05-23 00:00:00.000 A
782 782 2014-05-24 00:00:00.000 A
264 264 2014-05-23 09:02:32.000 A
951 951 2014-05-23 08:41:22.000 A
172 172 2014-05-23 00:00:00.000 A
527 527 2014-05-24 00:00:00.000 A
229 229 2014-05-23 14:10:37.000 A
364 364 2014-05-24 00:00:00.000 A
1005 1005 2014-05-24 00:00:00.000 A
26 26 2014-05-23 00:00:00.000 A
533 533 2014-05-24 00:00:00.000 A
86 86 2014-05-23 00:00:00.000 A
553 553 2014-05-24 00:00:00.000 A
63 63 2014-05-24 00:00:00.000 A
292 292 2014-05-23 09:30:36.000 A
633 633 2014-05-24 00:00:00.000 A
639 639 2014-05-24 00:00:00.000 A
854 854 2014-05-23 00:00:00.000 A
213 213 2014-05-23 00:00:00.000 A
499 499 2014-05-23 09:18:33.000 A
994 994 2014-05-23 00:00:00.000 A
307 307 2014-05-23 09:21:13.000 A
267 267 2014-05-24 00:00:00.000 A
1006 1006 2014-05-23 08:40:14.000 A
127 127 2014-05-23 00:00:00.000 A
814 814 2014-05-23 00:00:00.000 A
370 370 2014-05-23 00:00:00.000 A
107 107 2014-05-23 00:00:00.000 A
914 914 2014-05-23 00:00:00.000 A
130 130 2014-05-23 00:00:00.000 A
797 797 2014-05-23 00:00:00.000 A
728 728 2014-05-24 00:00:00.000 A
883 883 2014-05-23 00:00:00.000 A
7 7 2014-05-23 00:00:00.000 A
585 585 2014-05-23 00:00:00.000 A
691 691 2014-05-23 00:00:00.000 A
442 442 2014-05-23 08:12:05.000 A
834 834 2014-05-23 00:00:00.000 A
840 840 2014-05-23 00:00:00.000 A
24 24 2014-05-23 00:00:00.000 A
688 688 2014-05-23 00:00:00.000 A
711 711 2014-05-23 00:00:00.000 A
141 141 2014-05-24 00:00:00.000 A
757 757 2014-05-24 00:00:00.000 A
525 525 2014-05-23 00:00:00.000 A
974 974 2014-05-23 00:00:00.000 A
279 279 2014-05-23 00:00:00.000 A
671 671 2014-05-23 08:52:21.000 A
270 270 2014-05-23 00:00:00.000 A
857 857 2014-05-23 14:28:11.000 A
84 84 2014-05-23 14:00:09.000 A
153 153 2014-05-24 00:00:00.000 A
227 227 2014-05-23 08:29:05.000 A
559 559 2014-05-24 00:00:00.000 A
674 674 2014-05-24 00:00:00.000 A
508 508 2014-05-23 08:35:42.000 A
61 61 2014-05-23 00:00:00.000 A
482 482 2014-05-23 00:00:00.000 A
651 651 2014-05-23 00:00:00.000 A
800 800 2014-05-23 00:00:00.000 A
90 90 2014-05-23 00:00:00.000 A
290 290 2014-05-24 00:00:00.000 A
253 253 2014-05-23 09:29:58.000 A
339 339 2014-05-24 00:00:00.000 A
104 104 2014-05-24 00:00:00.000 A
119 119 2014-05-23 00:00:00.000 A
142 142 2014-05-24 00:00:00.000 A
875 875 2014-05-23 09:04:53.000 A
65 65 2014-05-24 00:00:00.000 A
720 720 2014-05-23 00:00:00.000 A
620 620 2014-05-24 00:00:00.000 A
858 858 2014-05-23 00:00:00.000 A
271 271 2014-05-23 13:31:56.000 A
812 812 2014-05-23 08:31:14.000 A
105 105 2014-05-23 00:00:00.000 A
228 228 2014-05-23 00:00:00.000 A
136 136 2014-05-23 00:00:00.000 A
540 540 2014-05-23 00:00:00.000 A
42 42 2014-05-24 00:00:00.000 A
5 5 2014-05-23 14:14:00.000 A
640 640 2014-05-23 00:00:00.000 A
689 689 2014-05-23 00:00:00.000 A
594 594 2014-05-24 00:00:00.000 A
500 500 2014-05-23 00:00:00.000 A
523 523 2014-05-23 08:04:59.000 A
1041 1041 2014-05-23 09:04:58.000 A
1024 1024 2014-05-23 08:18:28.000 A
139 139 2014-05-23 00:00:00.000 A
803 803 2014-05-23 00:00:00.000 A
623 623 2014-05-24 00:00:00.000 A
669 669 2014-05-23 07:50:35.000 A
128 128 2014-05-23 08:27:59.000 A
122 122 2014-05-23 00:00:00.000 A
866 866 2014-05-23 00:00:00.000 A
59 59 2014-05-23 00:00:00.000 A
772 772 2014-05-24 00:00:00.000 A
723 723 2014-05-23 00:00:00.000 A
108 108 2014-05-23 00:00:00.000 A
251 251 2014-05-23 14:00:23.000 A
531 531 2014-05-24 00:00:00.000 A
749 749 2014-05-23 00:00:00.000 A
743 743 2014-05-24 00:00:00.000 A
537 537 2014-05-23 00:00:00.000 A
145 145 2014-05-23 00:00:00.000 A
835 835 2014-05-23 00:00:00.000 A
71 71 2014-05-23 00:00:00.000 A
263 263 2014-05-23 08:40:24.000 A
117 117 2014-05-23 00:00:00.000 A
549 549 2014-05-24 00:00:00.000 A
526 526 2014-05-23 00:00:00.000 A
873 873 2014-05-24 00:00:00.000 A
77 77 2014-05-24 00:00:00.000 A
409 409 2014-05-24 00:00:00.000 A
280 280 2014-05-23 06:51:33.000 A
956 956 2014-05-23 00:00:00.000 A
217 217 2014-05-24 00:00:00.000 A
223 223 2014-05-23 00:00:00.000 A
518 518 2014-05-24 00:00:00.000 A
123 123 2014-05-23 08:26:14.000 A
558 558 2014-05-24 00:00:00.000 A
83 83 2014-05-23 05:41:26.000 A
581 581 2014-05-23 00:00:00.000 A
177 177 2014-05-23 08:22:48.000 A
652 652 2014-05-24 00:00:00.000 A
352 352 2014-05-23 08:57:45.000 A
91 91 2014-05-24 00:00:00.000 A
538 538 2014-05-24 00:00:00.000 A
495 495 2014-05-23 08:26:38.000 A
838 838 2014-05-24 00:00:00.000 A
947 947 2014-05-23 09:13:06.000 A
114 114 2014-05-23 00:00:00.000 A
20 20 2014-05-23 14:05:07.000 A
953 953 2014-05-24 00:00:00.000 A
841 841 2014-05-23 00:00:00.000 A
57 57 2014-05-23 00:00:00.000 A
798 798 2014-05-23 00:00:00.000 A
157 157 2014-05-23 00:00:00.000 A
578 578 2014-05-23 00:00:00.000 A
137 137 2014-05-23 00:00:00.000 A
790 790 2014-05-23 00:00:00.000 A
8 8 2014-05-23 00:00:00.000 A
598 598 2014-05-24 00:00:00.000 A
1039 1039 2014-05-23 00:00:00.000 A
151 151 2014-05-23 00:00:00.000 A
194 194 2014-05-23 09:11:33.000 A
541 541 2014-05-23 08:06:59.000 A
NULL 261 NULL P
NULL 593 NULL P
NULL 925 NULL P

Similar Messages

  • Employee attendance system

    hello all,
    what are the requirements for creating a employee attendance tracking system
    what are all the tables colums i want to create for the same

    HI user13792460
    FOR DATA BASE Side u can use intially
    --======================
      FOR DATA BASE
    --===========
    CREATE TABLE DEPT
    ( DEPTNO NUMBER(3),
    DNAME VARCHAR2(35) NOT NULL ,
    LOC VARCHAR2(17),
    CONSTRAINT PK_DEPT PRIMARY KEY ( DEPTNO ) );
    --==================================
    CREATE TABLE EMP
    ( EMPNO NUMBER(5) ,
    ENAME VARCHAR2(39)NOT NULL,
    JOB VARCHAR2(9),
    DEPTNO NUMBER(3),
    CONSTRAINT PK_EMP PRIMARY KEY ( EMPNO ) ,
    CONSTRAINT FK_DEPT FOREIGN KEY ( DEPTNO )   
    REFERENCES DEPT( DEPTNO )
    --=================================
    CREATE TABLE EMP_ATTENDANCE
    ( ATTEND_ID NUMBER(5) ,
    ATT_DATE DATE,
    TIME_IN  DATE,
    TIME_OUT  DATE,
    ATTENDANCE_FLAG  CHAR(1),
    PERMISSION_FLAG  CHAR(1),
    MISSION_FLAG     CHAR(1),
    HOLIDAY_FLAG      CHAR(1),
    EMPNO NUMBER(5) ,
    DEPTNO NUMBER(3),
    CONSTRAINT PK_ATTEND_ID PRIMARY KEY ( ATTEND_ID) ,
    CONSTRAINT FK_EMP_ATTEND FOREIGN KEY ( EMPNO )   
    REFERENCES EMP( EMPNO ),
    CONSTRAINT FK_DEPT_ATTEND FOREIGN KEY ( DEPTNO )   
    REFERENCES DEPT( DEPTNO )
    --==================================Viewing Information about constraints
    To see information about constraints, you can query the following data dictionary tables.
    --==================================
    SELECT * FROM  user_constraints;
    SELECT * FROM  user_cons_columns;
    --==================================
    Hope this helps u...
    Regards,
    Abdetu...

  • Need a function to calculate employee attendance data for a given period

    need a function to calculate employee attendance data for a given period
    as
    Working days,
    CL ,
    SL,
    PL,
    LWP
    regards,
    Gaurav Sood.

    Issue resolved

  • FM or Tcode for No.of days employee attended Training in HR ABAP

    Hi Experts,
    I need to calculate No.of Days employee attended training in given payroll period level.
    For ex, iam giving 01.2010 FY (Payroll Period 21.04.2010 to 20.05.2010) .
    Need to find out how many days each employee under traning during this period.
    In PA30 we can see his status (pa00001-stat1 = '2') but i need to calculate how many days he is under traning .
    In PA30, we can see the status changed from Training to Shopfloor or something, Since he is active his end date is 31.12.9999.
    Could  you please tell me where can we see traning information in System (tcode or table or Std program).
    Regards
    SK

    Hello
    You can see the training attended by an employee in the tcode PSV1 and PSV2. If you have LSO implemented in the system, then it will be LSO_PSV1 and LSO_PSV2.
    Regards
    Ranganath

  • Employee Attendance Related

    Hi
    I have two forms to mark employee attendance daily and employee Leave.Which employees are present marking attendance P into emp_attendance table.
    i have to keep record of the absent teacher who didn't inform and emplyee which are on leave.Which employees are on leave a remainder should be generated during the attendance time these employes are on leave from date till to date.who didn't inform there attendance mark as a casual leave automatically in attedance table..
    my leave type are
    P--Present
    CL---Casual Leave
    SL--Sick Leave
    PL---Planned Leave.
    i am defining below two tables which i made to mark employee attendance and employee leave.if u want suggest me some more field please suggest me.
    table1-EMP_ATTENDANCE
    EMP_ID
    ATTENDANCE_DATE
    ATTENDANCE_STATUS
    ARIVAL_TIME
    DEPARTURE TIME
    TABLE2-EMP_LEAVE
    Emp_ID
    LEAVE_TYPE
    START_DATE
    END_DATE
    Thanks
    Nisha.
    Edited by: Nisha Rani on Sep 6, 2009 11:29 PM

    Sure looks like school work to me so I'd suggest you put some more effort into this yourself.
    But one question does intrigue me based on what you provided ... what is an attendance status and, relationally speaking, how do these two tables relate? What prevents a person from being present while also on vacation?

  • IDOC  type related to Payroll and Employees Attendance and Absence

    Hi  Evrybody,
    Right now im working on ALE INBOUND Interface, which relates to transfer of data.
    I'm searching for an Basic IDOC  type related to Payroll and Employees Attendance and Absence,
    If any pointers would be much helpful.
    Thanks n Regards.
    [email protected]

    Solved myself.

  • Employee Attendance log in system

    Hello all,
    1. how to design employee attendance log in system using oracle forms and have to create reports for the same.?
    2. how to create tables for employee attendance log in system ?

    1. how to design employee attendance log in system using oracle forms and have to create reports for the same.?use any editor you know how to use,
    2. how to create tables for employee attendance log in system ?CREATE TABLE .....

  • Object: employee attendance maintainance

    Hi all,
       I am a fresher in ABAP and i am trying to work on employee attendance management for a company.
    i have one employee master, a department master, attendance transaction table. I have few doubts regarding the screen to update employees and screeen to maintain attendance and leave status .
    1. How do i validate the employeee date of birth?
    2. How do i get the total no. of working hours with entry time and exit time?
    3. How do i create a nuber range using SNRO and how do i get it to my program.
    Please if anybody have time answer it i am struggling a lot
    Thnaks in advance.
    Regrads

    hi check this..
    1. How do i validate the employeee date of birth?
    do like this..
    data: v_gbdat like pa0002-gbdat .
    select gbdat from pa0002 into v_gbdat
                      where pernr in s_pernr.
    2. How do i get the total no. of working hours with entry time and exit time?
    go to the table pa0007 ....check the fields...
    MOSTD
    WOSTD
    ARBST
    go to PA2012 for the time record..
    regards,
    venkat

  • Query for employee attendance

    Select Device_Person_id,personal_id,Date1,(
    cASE WHEN eXISTS(
    sELECT Device_Person_id FROM tempDeviceLogs AT WHERE T.personal_id=AT.Device_Person_id AND T.date1=AT.logDateTime
    ) then 'P' Else 'A' End )as Emp_Status
    FROM
    Select Device_Person_id,personal_id,Cast(logDateTime as DATE)AS DATE1 from Emp_setting a,(Select Distinct logDateTime from tempDeviceLogs) b
    ) T
    it causing error like "Invalid column name 'Device_Person_id'."
    how inout can be used in this query to get result.
    this is my first project don't have much idea so please help me.
    dbo.tempDeviceLogs table
    columnname datatype allownulls
    LogsID int Unchecked
    Device_Person_id int Unchecked
    Device_id int Unchecked
    logDateTime datetime Unchecked
    logVerifyMode nchar(10) Unchecked
    workCodeID int Unchecked
    Machin_install_id int Unchecked
    data_loaded_dt datetime Checked
    Inout int Checked
    dbo.Emp_setting
    columnname data type allownulls
    Empset_id int Unchecked
    personal_id int Unchecked
    DesignationID int Checked
    DivisionID int Checked
    Emp_status char(1) Checked
    Emp_TypeId int Checked
    Dept_Id int Checked
    Group_Id int Checked
    NDIVGRP_CODE bigint Checked
    dbo.persons_profile
    column name datatype allow nulls
    pesonal_id int Unchecked
    Emp_Code nchar(15) Checked
    Title nchar(4) Unchecked
    First_name varchar(35) Unchecked
    Middle_name varchar(35) Checked
    last_name varchar(35) Checked
    Father_Husband_Name varchar(35) Unchecked
    Dob datetime Unchecked
    Age int Unchecked
    gender nchar(1) Unchecked
    Marital_status nchar(1) Unchecked
    Nationality nchar(10) Unchecked
    bloodGroup nchar(10) Unchecked
    perAddress nchar(100) Unchecked
    PerStreet nchar(100) Checked
    PerLocation nchar(50) Unchecked
    PerCity nchar(20) Checked
    PerPincode nchar(6) Checked
    CorAddress nchar(50) Checked
    CorStreet nchar(50) Checked
    CorLocation nchar(50) Checked
    CorCity nchar(20) Checked
    CorPincode nchar(6) Checked
    LandlinePhone nchar(24) Checked
    cellNo nchar(24) Checked
    EmailId nchar(35) Checked
    NosofDependendants int Checked
    Dependendants_details ntext Checked
    Emergency_FirstName nchar(35) Checked
    Emergency_Middle_name nchar(35) Checked
    Emergency_Last_name nchar(35) Checked
    Emergency_WithRelation nchar(25) Checked
    Emergency_PhoneNo nchar(22) Checked
    Emergency_CellNo nchar(22) Checked
    Emergency_emailId nchar(35) Checked
    Office_PF_ac_no nchar(20) Checked
    ESI_ac_no nchar(20) Checked
    JoinedDate datetime Checked
    Photofile nchar(50) Checked
    ReportTo varchar(50) Checked
    Brief_Notes nchar(150) Checked
    dateofTermination varchar(10) Checked
    termination_note nchar(50) Checked
    Print_Priority int Checked
    DeviceEmployeeID nchar(25) Checked
    LogsPermitted int Unchecked
    Machin_install_id int Checked
    Designation nchar(100) Checked
    Dept nchar(100) Checked
    Section nchar(100) Checked
    Groups nchar(100) Checked
    EmpWorkingTypeT nchar(100) Checked

    Select Device_Person_id,personal_id,Date1,
    cASE WHEN eXISTS(
    sELECT Device_Person_id FROM tempDeviceLogs AT WHERE T.personal_id=AT.Device_Person_id AND T.date1=AT.logDateTime
    ) then 'P' Else 'A' End as Emp_Status
    FROM
    Select Device_Person_id,personal_id,Cast(logDateTime as DATE)AS DATE1 from Emp_setting a,(Select Distinct logDateTime from tempDeviceLogs) bfrom TBL
    ) TLooks you missed FROM clause in T Subquery
    Best Regards,Uri Dimant SQL Server MVP,
    http://sqlblog.com/blogs/uri_dimant/
    MS SQL optimization: MS SQL Development and Optimization
    MS SQL Consulting:
    Large scale of database and data cleansing
    Remote DBA Services:
    Improves MS SQL Database Performance
    SQL Server Integration Services:
    Business Intelligence

  • How to display Employee Attendance Data in Crosstab Format?

    Hi all,
    I have the data in sql server 2005 like below, which saves the employee in date and in time and entry type 
    How can i create a cross tab query for the above records in sql server 2005. and i need the record in the below format:
    where 1, 2, 3 are indate days, and below is intime, out time and the difference of hours per employee...
    How can i achieve it as i have to make report for it... need sql query or stored procedure for the format required.
    Thanks in adv.

    One could argue that the crosstab is best produced in the presentation layer and that SQL Server should only return the raw data. But if you like to hurt yourself...
    First you need an unpivoting query to put starttime, endtime and length in a single row. Since all columns in a row needs to have the same data type, this requires some care.
    We take this CTE:
    WITH CTE AS (
      SELECT t.EmpID, u.n, datepart(day, t.starttime) AS day
             substring(convert(char(23),
                CASE u.n WHEN 1 THEN t.starttime
                         WHEN 2 THEN t.endtime
                         WHEN 3 THEN dateadd(ss, datediff(ss, t.starttime, t.endtime), '19000101')
                END, 108), 11, 5)
      FROM   tbl
      CROSS  JOIN (SELECT n = 1 UNION ALL SELECT 2 UNION ALL SELECT 3)
      WHERE  t.starttime >= @month + '01'
        AND  t.starttime <  dateadd(month, 1, @month + '01')
    I assume here that @month is on the form YYYYMM.
    Before I go on, I like to point out that something you need to consider is what output you want if there are multiple entries the same day. And even worse, what output do you want if the intervals are overlapping? To keep this post down in complexity, I
    will ignore this situation, but I like to stress that unless you have the appropriate triggers and constraints in place, you will have that sort of data in a real production scenarion. Bad data knows how to creep in.
    With the CTE above, we can now pivot the data per day. It is kind of boring to write:
    SELECT EmpID,
           MIN (CASE day WHEN 1 THEN data END) AS [1],
           MIN (CASE day WHEN 2 THEN data END) AS [2],
           MIN (CASE day WHEN 31 THEN data END) AS [31]
    FROM   CTE
    GROUP  BY EmpID, n
    ORDER  BY EmpID, n
    Note: all code here is untested. If you want a tested solution, you need to supply the CREATE TABLE statements for your table and sample data as INSERT statements.
    Erland Sommarskog, SQL Server MVP, [email protected]

  • Employee Info Query

    hello,
    Employee information report was requested like:
    ENO,Grade,Job,salary,etc
    I have managed to select most of the required data using the following query: (it's for one employee and gives me 2 records because of the change in salary)
    select *
    from per_all_people_f e
    ,per_all_assignments_f a
    ,HR_ALL_ORGANIZATION_UNITS o
    ,PAY_COST_ALLOCATION_KEYFLEX k
    ,per_jobs j
    ,PER_ALL_POSITIONS s
    ,HR_LOCATIONS_ALL_TL l
    ,per_grades g
    ,per_grade_definitions d
    ,PER_pay_proposals y
    ,pay_people_groups u
    where
    a.PERSON_ID(+)=e.PERSON_ID
    and e.attribute30 = 5291
    and a.ORGANIZATION_ID=o.ORGANIZATION_ID
    and o.COST_ALLOCATION_KEYFLEX_ID=k.COST_ALLOCATION_KEYFLEX_ID(+)
    and e.person_id in ('322','1018') -- 3 records
    and e.BUSINESS_GROUP_ID = 229
    and a.JOB_ID=j.JOB_ID(+)
    and a.POSITION_ID=s.POSITION_ID(+)
    and a.LOCATION_ID=l.LOCATION_ID
    and a.GRADE_ID=g.GRADE_ID
    and g.GRADE_DEFINITION_ID=d.GRADE_DEFINITION_ID
    and a.ASSIGNMENT_ID=y.ASSIGNMENT_ID
    and a.PAYROLL_ID=u.PEOPLE_GROUP_ID
    My first question is:For any employee how can i choose the record with the most recent change in salary?
    Another issue how can i join the element tables to the query above? I need to add 2 columns of elements such as car hire and children with the values assigned to employees within the employee record. How can I do that?
    Help please...

    My first question is:For any employee how can i choose the record with the most recent change in salary?you should pass a datetrack condition in the above query i.e.
    sysdate between e.effective_start_date and e.effective_end_date and
    sysdate between a.effective_start_date and a.effective_end_date
    or you can pass whatever date instead of sysdate.
    Another issue how can i join the element tables to the query above? I need to add 2 columns of elements such as car hire and children with the values assigned to employees within the employee record. How can I do that?You can join pay_element_entries_f table with assignment_id from per_all_assignments_f. Further you can join pay_entry_values_f with pay_element_entries_F with element_entry_id

  • Management of Global Employees (MGE) query

    Hello all,
    We are implementing MGE (Management of Global Employees) functionality for Personnel Administration for a global company. I have activated all Global Employment (GE) switches in table T77S0 after consultation with SAP. We don't plan to implement Global Payroll, but only the concept of Person ID which will be unique even the employee is transferred from one country to other. I have set up Generation and Selection Rule for Person ID. I would like to know if Person Id can be used for Master Data maintenance and can it be used in Reports as a primary query criteria (instead of PERNR). Also want to know how to set up Personnel Actions related to country transfer within MGE.
    I would like to know experiences from the real-time implementations. Anyone worked on Global Employment and Person ID implementation?
    Thanks.

    Hi,
    1. How to do use PNPCE logical database for Std and custom reports? Do we need to activate LDB PNPCE?
    If you have activated MGE, PNPCE gets activated with it. For custom reports, the developers need to include the LDB in their code. But it should be available in all standard reports and queries. Although, you will have to be careful if you are converting any custom reports as the u201Cget pernr/perasu201D statements differ. Iu2019m not technical but I saw some interesting threads on that topic here. You might want to check those.
    2. The use of Person Id for master data maintenance (instead of PERNR), would it be a problem for other HR modules implementation in future e.g. Benefits.
    I think for other modules, you should stick to personnel number.
    3. Instead of using std. SAP MGE actions- 81, 82, 83, can I create custom personnel actions and custom infogroups (with std HR infotypes). The std MGE actions look complicated for the business users.
    Yes, this is possible. You need to modify feature ACTCE accordingly for the following logical keys:
    EXPATPLANNING=81
    EXPATACTHOST=82
    EXPATACTHOME=83
    EXPATCHANGE=84
    The logical keys come predefined. Simply equate them to the custom action types. You can read the documentation for this feature for more information.
    4. Is it ok if I don't use the Infotypes related to MGE e.g. IT 706, 707, 710, 715 (except IT709 which gets created by the system) since we want to use the basic level of MGE and not implementing global payroll.
    I believe you need IT0710 and IT0715 to track assignment details and statuses if it is in line with the client business process. You can ignore IT0706 and IT0707 as you are not implementing the payroll piece of MGE.
    Hope this helps.
    Donnie

  • Help: marked of attendance query

    dear all.
    i have a table with this structure
    COD - VARCHAR2(1)
    FECH - DATE
    i have the next records:
    1 20/01/2008
    1 21/01/2008
    1 24/01/2008
    Well. i explain that:
    The idea is show "FALTA" when not exists row belongs to the user with code "1", based in the dates.
    For example if i query through a report it shows:
    CODIGO ASISTENCIA
    1 20/01/2008
    1 21/01/2008
    1 FALTA
    1 FALTA
    1 24/01/2008
    That is because the days 22/01/2008 and 23/01/2008 doesn't exists records and show the word "FALTA".
    There are a way to do that? I dont want to do any changes in the table structure.
    Thanks a lot.

    Hi,
    You need to outer-join your table to a table that has all the dates of interest.
    You probably don't have such a table, but you can generate a result set (like all_dates, below) that will work just as well.
    WITH   all_dates    AS
         SELECT     TO_DATE (:start_date, 'DD/MM/YYYY') + LEVEL - 1     AS dt
         FROM     dual
         CONNECT BY     LEVEL     <= 1 + ( TO_DATE (:end_date,   'DD/MM/YYYY')
                               - TO_DATE (:start_date, 'DD/MM/YYYY')
    SELECT     cod     AS codigo
    ,     NVL ( TO_CHAR (fech, 'DD/MM/YYYY')
             , 'FALTA'
             )     AS asistencia
    FROM             all_dates     ad
    LEFT OUTER JOIN     table_x          tx     PARTITION BY (cod)
    ON      ad.dt     = tx.fech
    ORDER BY     cod
    ,               dt;

  • OIM - EBS - Employee termination query

    I have configured OIM (9101) with EBS HR (9043) with Weblogic 10.3.
    I want to know how Employee termination works. Right now if I manually enable/disable any user, the Enable User and Disable User tasks are triggered and the user is enabled/diabled in the EBS system. But I am not able to understand the flow from HR system to OIM i.e. when a user is terminated in HR system ( I don't know how), will it trigger the disable user task in OIM.
    Please put some light on this matter. Thanks !!!

    I always found the trusted source status mapping not to work. I would suggest creating a UDF called EBS Status. Create an entity and process adapter that both do the following:
    Check the status field. Then either use the enable api or the disable api. On the entity adapter though, you should only put it on post-insert and only check if you need to disable the user.
    Create a user form trigger (explained many many times on this forum). Add the task to your Xellerate User profile. Then use the adapter you created as a process task adapter to enable or disable the oim user based on the new value.
    -Kevin

  • Missing Attendance Query.

    HI,
    I have two tables
    1. attendance
    2. Emp
    In attendance table i have the following colums
    Emp_no ,date,Present_flag
    In emp table
    emp_no
    How to find the missing attendance......
    for eg: if i pass 01-JUN-10 to 30-JUN-10 as parameter i need to get emp_no and date for which there
    is no record in attendance table.
    Pls help...

    Something like this ?
    SQL> ed
    Wrote file afiedt.buf
      1  WITH EMPl AS (SELECT 1 empno,'A' ename FROM DUAL UNION ALL
      2               SELECT 2 empno,'B' ename FROM DUAL
      3               )
      4  ,Att AS (SELECT 1 empno,to_date('01-JUN-2010','DD-MON-YYYY') dt, 'Y' Present FROM DUAL UNION ALL
      5           SELECT 1 empno,to_date('02-JUN-2010','DD-MON-YYYY') dt, 'Y' Present FROM DUAL UNION ALL
      6           SELECT 1 empno,to_date('03-JUN-2010','DD-MON-YYYY') dt, 'Y' Present FROM DUAL UNION ALL
      7           SELECT 1 empno,to_date('05-JUN-2010','DD-MON-YYYY') dt, 'Y' Present FROM DUAL UNION ALL
      8           SELECT 1 empno,to_date('06-JUN-2010','DD-MON-YYYY') dt, 'Y' Present FROM DUAL UNION ALL
      9           SELECT 1 empno,to_date('07-JUN-2010','DD-MON-YYYY') dt, 'Y' Present FROM DUAL UNION ALL
    10           SELECT 2 empno,to_date('01-JUN-2010','DD-MON-YYYY') dt, 'Y' Present FROM DUAL UNION ALL
    11           SELECT 2 empno,to_date('02-JUN-2010','DD-MON-YYYY') dt, 'Y' Present FROM DUAL UNION ALL
    12           SELECT 2 empno,to_date('03-JUN-2010','DD-MON-YYYY') dt, 'Y' Present FROM DUAL UNION ALL
    13           SELECT 2 empno,to_date('04-JUN-2010','DD-MON-YYYY') dt, 'Y' Present FROM DUAL UNION ALL
    14           SELECT 2 empno,to_date('07-JUN-2010','DD-MON-YYYY') dt, 'Y' Present FROM DUAL
    15            )
    16  ,date_range AS ( select to_date('01-JUN-2010','DD-MON-YYYY')-1 + level dt
    17                   from dual
    18                   connect by level <= (to_date('07-JUN-2010','DD-MON-YYYY') -
    19                   to_date('01-JUN-2010','DD-MON-YYYY')+1 )
    20                 )
    21  SELECT DISTINCT b.empno,a.ename,c.dt FROM  EMPL a,Att b,date_range c
    22  WHERE c.dt NOT IN (SELECT dt FROM Att inner_b where inner_b.empno=b.empno)
    23  AND a.empno=b.empno
    24* order by 1
    SQL> /
         EMPNO E DT
             1 A 04-JUN-10
             2 B 05-JUN-10
             2 B 06-JUN-10

Maybe you are looking for

  • HT201303 How do you change your security questions for your iTunes accout?

    How can I change my security questions for my iTunes account?

  • Problem Rounding Corners in Flex 3

    Hi, I'm having some problems rounding my panel and controlbar. Actually, the corners are rounded. The problem is that at the bottom of the panel are light gray squares peeking out from behind the rounded corners. If I put a dropshadow on the panel th

  • Movie Downloads To DVD???

    Hello, I was just wondering if it is at all possible to burn movies downloaded from the iTunes Store to a DVD-R. If so, could iTunes burn it for me...what others could i use if iTunes wont???? Thanks alot! Brad

  • Oracle APEX Installation/configuration in Oracle 11g

    Hi, I installed oracle 11g and planing to configure Oracle Application Express(APEX). which one is better in this.. Scenario 1: Downloading from OTN and Configuring the Embedded PL/SQL Gateway Scenario 2: Downloading from OTN and Configuring Oracle H

  • Unable to Access Allowance in Account Info

    I have set up an Allowance for my child. I Tunes states I can go to 'account info' to suspend, change and cancel the allowance---BUT I can not find where in account info this preference is. Can any one direct me where to find the Allowance settings?