How to manually set a return value to a subquery with multiple results I have a subquery which can return multiple results if a customer has duplicated sales codes. 

I currently LIMIT 1 to just return the most recent but ... Is there away to return NULL or "DUPLICATE" if RESULT &gt; 1?

I am using this field to overwrite a field which already has a default - therefore, I would just prefer to use the default or raise an alert for rectification.
You could try something like this, add a select case to your subquery

select (select case when (select count(*) from subquery) &gt;1 then 'duplicate' else 'not duplicate' end)


Though I'm not sure if I would recommend that, but there is one method.