I\'ve this query:
SELECT `id` , `naam` FROM `klanten` WHERE ( `email` LIKE \'%@domain.nl%\' OR `email2` LIKE \'%@domain.nl%\' )
But
Here is a sample query for a table having a foreign key relationship to the same table with a query parameter.
SET @x = -1; SELECT id, categoryName FROM Catergory WHERE IF(@x > 0,category_ParentId = @x,category_ParentId IS NOT NULL);
@x can be changed.
@x