Aldan
Aldan

Reputation: 715

DELETE null from Query Result

I have a request to generate attendance and the results in Lines 1 and 2 are showing null, the Query is uploaded here

| FingerId | ShiftId | DateIn     | DateOut    | ScanIn   | ScanOut  | WorkhourIn | WorkhourOut | TIME_IN   | TIME_OUT  |
| -------- | ------- | ---------- | ---------- | -------- | -------- | ---------- | ----------- | --------- | --------- |
| 61       | 10      |            | 2020-04-09 |          |          |            | 21:00:00    |           |           |
| 61       | 10      |            | 2020-04-08 |          |          |            | 21:00:00    |           |           |
| 61       | 10      | 2020-04-07 | 2020-04-08 | 20:52:50 | 07:29:46 | 21:00:00   | 07:00:00    | -00:07:10 | -06:30:14 |
| 61       | 10      | 2020-04-08 | 2020-04-09 | 21:04:49 | 07:21:32 | 21:00:00   | 07:00:00    | 00:04:49  | -06:38:28 |

Is there something wrong with the query that I made? precisely at GROUP BY and How do I delete or not display null on the first and second lines?

[UPDATED]

Implementing IS NOT NULL to the query precisely to the WHERE filter

FROM :

WHERE
    FingerId = 61
ORDER BY
    q.FingerId ASC,
    DateIn ASC

To :

WHERE
    FingerId = 61
    AND FingerId IS NOT NULL
    /* AND other fields that will be applied IS NOT NULL status */

For more details I update it here

Upvotes: 0

Views: 38

Answers (1)

DereckChamboko
DereckChamboko

Reputation: 287

WHERE
FingerId = 61
AND FingerId IS NOT NULL
AND ShiftId IS NOT NULL
AND DateIn IS NOT NULL
AND DateOut IS NOT NULL
AND ScanIn  IS NOT NULL
AND WorkhourIn IS NOT NULL
AND WorkhourOut IS NOT NULL
AND TIME_IN IS NOT NULL
AND TIME_OUT IS NOT NULL

change your where clause to look like this implementing the "IS NOT NULL" funtion

IS NOT NULL

Upvotes: 1

Related Questions