jeudi 21 juillet 2016

how to filter records that including null values and other status

Currently i am running below query in sql server. How to filter whose checkpointstatus is not 'Completed' including null values. But the issue is i am not able to get those records whose values are null

  SELECT * FROM TAMS.OrderDetail WHERE CheckPointStatus != 'Completed'

I have tried to fix this by

  SELECT * FROM TAMS.OrderDetail WHERE coalesce(CheckPointStatus, '') !=  'Completed'

But just want to make sure is this correct way

Aucun commentaire:

Enregistrer un commentaire