select att.id as attachment_id, att_log.user_id, att_log.visits from attachments as att left join attachment_logs as att_log on att.id=att_log.attachment_id