Issue: The MIDL column is supposed to include (UL_ID, "x001"), x001 representing a unique household. If there are duplicated households, then the base of the MIDL should stay the same, while the second value increases by 1 (which means there is more than one household on the said address). Now, I managed to cheat with numbers up to 9 for a while, because I can set the base as (UL_ID, "x00") and simply add values for each additional duplicate, but once you go over 9, you end up with x0010, while the value can't exceed 12 characters. NOTE: The number of households extends to 60 in some cases.
Before:
ADDRESS                    MIDL              UL_ID
---------------------------------------------------
AŠKERČEVA ULICA 6                          14044272
AŠKERČEVA ULICA 6                          14044272
AŠKERČEVA ULICA 6                          14044272
AŠKERČEVA ULICA 6A                         14044264
AŠKERČEVA ULICA 7                          14044299
BAZOVIŠKA ULICA 25                         14037390
BELOKRIŠKA CESTA 10                        17097687
BELOKRIŠKA CESTA 10                        17097687
BELOKRIŠKA CESTA 10                        17097687
BELOKRIŠKA CESTA 10                        17097687
After:
ADDRESS                    MIDL              UL_ID
----------------------------------------------------
AŠKERČEVA ULICA 6       14044272x001        14044272
AŠKERČEVA ULICA 6       14044272x002        14044272
AŠKERČEVA ULICA 6       14044272x003        14044272
AŠKERČEVA ULICA 6A      14044264x001        14044264
AŠKERČEVA ULICA 7       14044299x001        14044299
BAZOVIŠKA ULICA 25      14037390x001        14037390
BELOKRIŠKA CESTA 10     17097687x001        17097687
BELOKRIŠKA CESTA 10     17097687x002        17097687
BELOKRIŠKA CESTA 10     17097687x003        17097687
BELOKRIŠKA CESTA 10     17097687x004        17097687
UPDATE
P.Salmon thought up of a working solution
SELECT T.ADDRESS,
     CONCAT(T.UL_ID,'x' ,lpad(IF(T.UL_ID <> @P,@RN:=1,@RN:=@RN+1),3,'0')) MIDL, T.UL_ID,
     @P:=T.UL_ID P
FROM (SELECT @RN:=0,@P:=0) RN,T
 
     
    