I am trying to find the which cats took longer than average to sell. This is what i have so far:
Select SaleAnimal.AnimalID, SaleAnimal.SaleID, Sale.SaleDate, Animal.category
FRom Animal INNER JOIN (SaleAnimal INNER JOIN Sale ON SaleAnimal.SaleID = Sale.SaleID) ON Animal.AnimalID = SaleAnimal.AnimalID
WHERE ((Animal.Category = 'Cat') AND (Sale.SaleDate > (Select AVG(SaleDate) FROM Animal INNER JOIN ( SaleAnimal INNER JOIN Sale ON SaleAnimal.SaleID = Sale.SaleID) ON Animal.AnimalID = SaleAnimal.AnimalID
WHERE (Animal.category = 'Cat'))));
My problem is that it doesn't like how I am trying to average a date. I'm trying to look this up, but I'm not having very goodluck. (i thought I found a site on google, but you have to be a member to view the site)
Does anyone know the syntax to average a date? I believe otherwise this is correct.
Select SaleAnimal.AnimalID, SaleAnimal.SaleID, Sale.SaleDate, Animal.category
FRom Animal INNER JOIN (SaleAnimal INNER JOIN Sale ON SaleAnimal.SaleID = Sale.SaleID) ON Animal.AnimalID = SaleAnimal.AnimalID
WHERE ((Animal.Category = 'Cat') AND (Sale.SaleDate > (Select AVG(SaleDate) FROM Animal INNER JOIN ( SaleAnimal INNER JOIN Sale ON SaleAnimal.SaleID = Sale.SaleID) ON Animal.AnimalID = SaleAnimal.AnimalID
WHERE (Animal.category = 'Cat'))));
My problem is that it doesn't like how I am trying to average a date. I'm trying to look this up, but I'm not having very goodluck. (i thought I found a site on google, but you have to be a member to view the site)
Does anyone know the syntax to average a date? I believe otherwise this is correct.