Add protection against sub-query returning more than one row

I ran into a bug where I had duplicate data in a data_table. (2 users saving the same entries at the same time)

Sub-query that returns multiple rows make MySQL crash, so I added simple protection against this.

Lots of extensions might need this patch too and I think I have spotted a kind of related bug in Select Box Link Field.