1) This query will give the userid, display name and login name of all users that have a display name that doesn't match their login name.

SQL Query
select USER_ID,USER_DISPLAY_NAME,USER_LOGIN_NAME
from ubbt_USERS
where USER_DISPLAY_NAME <> USER_LOGIN_NAME

2) To change a user's display name to match their login name you can run the query below, just substitute $userid with the userid in question:

SQL Query
update ubbt_USERS
set USER_LOGIN_NAME=USER_DISPLAY_NAME
where USER_ID = '$userid'