wrote query inventory