question

tnforsythe avatar image
tnforsythe asked

Provide the SQL statement and the result that displays the warehouse ID, location, and total inventory value for warehouse with the greatest inventory value.

![alt text][1] [1]: /storage/temp/2351-capture.png How do I write this statement givem the logical model shown?
sql-server-2008homeworksumsubquery
capture.png (15.2 KiB)
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

·
rj_leo avatar image
rj_leo answered
select top 1 a.wh_id, a.wh_loc, sum(b.unit_cost*b.qty_onhand) from warehouse a inner join inventory b on a.wh_id = b.wh_id group by a.wh_id, a.wh_loc order by sum(b.unit_cost*b.qty_onhand) desc
4 comments
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Usually when doing peoples homework, it's best to lead them to the answer rather than just provide it outright. After all, you're not getting graded.
1 Like 1 ·
Opps my bad :/ I'm new here
0 Likes 0 ·
Don't worry about it, @rj_leo - welcome to the AskSSC family!
0 Likes 0 ·
Yeah, not a problem. Keep answering questions, please.
0 Likes 0 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.