select wbdconf.recordno, wbdconf.distid, wbdconf.distiddesc, wbdconf.lastdist, wbdconf.lastdistdate, wbdconf.altemail, wbdconf.altemailyn, wbdconf.wbd_method, wbdconf.wbd_type, tPerson.emailaddress, wbdconf.passwd, wbdconf.sdate, wbdconf.edate, wbdlist.grid, tPerson.emailaddress from wbdconf, wbdlist, tPerson where wbdconf.distid = wbdlist.distid and wbdconf.userid = "email" and (tPerson.emailaddress is not null and tPerson.emailaddress != " ") and wbdconf.recordno = tPerson.PersonID and wbdconf.sdate <= "31/01/2011" and (wbdconf.edate IS NULL or (wbdconf.edate IS NOT NULL and wbdconf.edate > "31/01/2011") ) UNION select wbdconf.recordno, wbdconf.distid, wbdconf.distiddesc, wbdconf.lastdist, wbdconf.lastdistdate, wbdconf.altemail, wbdconf.altemailyn, wbdconf.wbd_method, wbdconf.wbd_type, wbdconf.userid, wbdconf.passwd, wbdconf.sdate, wbdconf.edate, wbdlist.grid, tPerson.emailaddress from wbdconf, wbdlist, tPerson where wbdconf.distid = wbdlist.distid and wbdconf.userid != "email" and wbdconf.recordno = tPerson.PersonID and wbdconf.sdate <= "31/01/2011" and (wbdconf.edate IS NULL or (wbdconf.edate IS NOT NULL and wbdconf.edate > "31/01/2011") ) order by 1, 2