Skip to main content

Error: Subquery returned more than 1 value. This is not permitted when the subquery follows =, !=, <, <=, >, >= or when the subquery is used as an expression.

Error when entering a sickness: Subquery returned more than 1 value.

H
Written by Harry Ledger
Updated over 2 weeks ago

Sometimes, issues may be caused by overlapping records in the system. The most common causes are:

  • Overlapping holiday year records, either system-wide or specific to an employee

  • Overlapping sickness records for an employee

To resolve this, you'll need to run a data export to identify any problematic entries, then correct the data before trying again.

Check for overlapping holiday year records

  1. Log in to the SelectHR Administrator Tool.

  2. Click Import/Export Data.

  3. Click Create an export definition.

  4. Click Select the data to export.

  5. Change the database to SelectHR and log in.

  6. Copy and paste the SQL below:

    SELECT 
    hhd.[Person Number],
    hhd.Year AS year1,
    hhd.[Holiday Year Start] AS s1,
    hhd.[Holiday Year End] AS e1,
    hhd1.Year AS year2,
    hhd1.[Holiday Year Start] AS s2,
    hhd1.[Holiday Year End] AS e2,
    p.[First Name],
    p.Surname,
    p.[Effective Status]
    FROM Absence.[Holiday History Data] hhd
    INNER JOIN Absence.[Holiday History Data] hhd1
    ON hhd.[Person Number] = hhd1.[Person Number]
    AND hhd.Year = hhd1.Year + 1
    INNER JOIN Person.Snapshot p
    ON hhd.[Person Number] = p.[Person Number]
    WHERE hhd1.[Holiday Year End] >= hhd.[Holiday Year Start];
  7. In the top-left corner of the data export window, click Options > Paste SQL from clipboard.

  8. Click Data to run the export.

  9. If any records are returned, correct them using the Holiday History Process.

    • Tick Do Not Recalculate and make sure the dates do not overlap.


Check for overlapping sickness records

  1. Log in to the SelectHR Administrator Tool.

  2. Click Import/Export Data.

  3. Click Create an export definition.

  4. Click Select the data to export.

  5. Change the database to SelectHR and log in.

  6. Copy and paste the SQL below:

    SELECT DISTINCT
    ah.[Absence Number],
    ah.[Absence Type],
    ah2.[Absence Type] AS [Absence2 Type],
    ah.[Person Number],
    ah.Workflow,
    ah.[Absence Start Date],
    ah.[Absence End Date],
    ah2.Workflow AS [Absence2 Workflow],
    ah2.[Absence Number] AS [Absence2 Number],
    ah2.[Absence Start Date] AS [Absence2 Start Date],
    ah2.[Absence End Date] AS [Absence2 End Date],
    pd.[Formal Name]
    FROM absence.history ah
    INNER JOIN absence.days ad
    ON ah.[Absence Number] = ad.[absence number]
    INNER JOIN absence.days ad2
    ON ad2.[absence Date] = ad.[Absence Date]
    INNER JOIN absence.history ah2
    ON ah2.[Absence Number] != ah.[Absence Number]
    AND ah2.[Absence Number] = ad2.[Absence Number]
    AND ah.[Person Number] = ah2.[Person Number]
    INNER JOIN Person.Details pd
    ON pd.[Person Number] = ah2.[Person Number]
    WHERE ah.[Absence Type] = 'sickness'
    AND ah2.[Absence Type] = 'sickness';
  7. In the top-left corner of the data export window, click Options > Paste SQL from clipboard.

  8. Click Data to run the export.

  9. If any overlapping sickness records are returned, use the Absence History Process to edit or remove the records.

๐Ÿค“ Tip: If a sickness record is open-ended, do not delete it until youโ€™ve added an end date.

Did this answer your question?