create or replace view item_middle_thm_view as select dbr_item.*, bd_file_url, media_id1, media_id2, media_id3, media_id4, media_id5, pc1, pc2, pc3, pc4, pc5, pc6, pc7, pc8, pc9, pc10, pd1, pd2, pd3, pd4, pd5, pd6, pd7, pd8, pd9, pd10 from dbr_item inner join dbr_igroup on dbr_igroup.id = dbr_igroup.id inner join dbr_item_thm on dbr_item.id = dbr_item_thm.id left join ( select media_id, bd_file_url from dbr_media_bd where image_type = 'middle' ) as com on com.media_id = dbr_item.media_id