SELECT tbl_port_config.*, (SELECT TOP 1 error_counter1 FROM tbl_port_errors WHERE switch_id =tbl_port_config.switch_id) como error_counter_1 WHERE ......