sql query to daily update share stats