Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
dlmagers10
Starting Member
48 Posts |
Posted - 2010-11-21 : 20:18:59
|
I need to write and execute a command to retrieve the branch number and units for each branch having more than 25 books on hand.Tables BRANCH: BRANCH_NUM, BRANCH_NAME, BRANCH_LOCATION, NUM_EMPLOYEESINVENTORY: BOOK_CODE, BRANCH_NUM, ON_HANDTHIS IS WHAT i HAVE SO FAR:SELECT BRANCH.BRANCH_NUM, INVENTORY.ON_HANDFROM INVENTORY, BRANCHWHERE BRANCH.BRANCH_NUM = INVENTORY.BRANCH_NUMAND INVENTORY.ON_HAND > '25';ALL I AM COMING UP WITH IS THE TWO COLUMN HEADINGS: BRANCH_NAME AND NUM_EMPLOYEES.I DEFINITELY NEED HELP WITH THIS ONE. PLEASE. |
|
dataguru1971
Master Smack Fu Yak Hacker
1464 Posts |
Posted - 2010-11-21 : 20:52:44
|
SELECT BRANCH.BRANCH_NUM, SUM(INVENTORY.ON_HAND) as UnitsOnHandFROM BRANCH JOIN INVENTORY ON BRANCH.BRANCH_NUM = INVENTORY.BRANCH_NUMGROUP BY BRANCH.BRANCH_NUMHAVING SUM(INVENTORY.ON_HAND)>25Good luck with the rest of your homework Poor planning on your part does not constitute an emergency on my part. |
 |
|
dlmagers10
Starting Member
48 Posts |
Posted - 2010-11-22 : 10:08:10
|
Thank you. |
 |
|
|
|
|