SET @imgname="<file name>"; SELECT * FROM image WHERE img_name=@imgname; SELECT * FROM oldimage WHERE oi_name=@imgname; SELECT * FROM filearchive WHERE fa_name=@imgname;