Home:ALL Converter>MySQL exclude NULL / empty match?

MySQL exclude NULL / empty match?

Ask Time:2016-08-03T19:37:19         Author:daninthemix

Json Formatter

I've got this statement:

SELECT id FROM laptops
WHERE (hostname = :hostname)
OR (asset_tag = :asset_tag)
OR (serial = :serial) LIMIT 1

Essentially I want to check there isn't a match on any of those three fields. The problem is, I'm getting matches where there shouldn't be, which leads me to think that if one of those fields is empty in both MySQL and the data being checked, it flags as a match. Does that sound correct? If so, how I can exclude empty values from this matching process?

Author:daninthemix,eproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/38742483/mysql-exclude-null-empty-match
The Shooter :

@Gordon: I think he is looking for\n\nSELECT id FROM laptops\nWHERE (hostname != :hostname)\nAND (asset_tag != :asset_tag)\nAND (serial != :serial) LIMIT 1\n",
2016-08-03T11:44:59
yy