Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Task 9 #1

Closed
Felipe-Hub opened this issue Oct 15, 2020 · 2 comments
Closed

Task 9 #1

Felipe-Hub opened this issue Oct 15, 2020 · 2 comments

Comments

@Felipe-Hub
Copy link

@sandrabosk

Could not find a solution for task 9 that uses the tools learned so far (the suggested solution is not working, since alias and window functions are not supported in 'where' clauses). Workaround would be with subqueries, but it is a topic to be presented in the next unit.

Workaround:
select * from (select rental_id, inventory_id, datediff(return_date, rental_date) num_days, avg(datediff(return_date, rental_date)) over (partition by inventory_id) avg_return_days
from rental) as t
where t.num_days < t.avg_return_days;

@haggarw3
Copy link
Contributor

Yes this looks like a question for the next topics , so I have removed this question from this activity

@ironhack-edu
Copy link
Contributor

Solved, merged. Thank you both!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants