MySQL Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsDatabasesMySQL Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old October 28th, 2012, 10:33 PM
siddardhab siddardhab is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2012
Posts: 2 siddardhab User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 40 m 20 sec
Reputation Power: 0
Need help with this query

My database structure is

http:// imgur.com/ LkqBI (can't post links-Remove spaces)

I need to Find customers who own an account with a balance larger than that average balance of all accounts held in branches located in the same state as the customer. Display information as described in query above.

Reply With Quote
  #2  
Old October 29th, 2012, 04:35 AM
cafelatte cafelatte is offline
Contributing User
Dev Shed Intermediate (1500 - 1999 posts)
 
Join Date: Mar 2008
Posts: 1,923 cafelatte User rank is Major (30000 - 40000 Reputation Level)cafelatte User rank is Major (30000 - 40000 Reputation Level)cafelatte User rank is Major (30000 - 40000 Reputation Level)cafelatte User rank is Major (30000 - 40000 Reputation Level)cafelatte User rank is Major (30000 - 40000 Reputation Level)cafelatte User rank is Major (30000 - 40000 Reputation Level)cafelatte User rank is Major (30000 - 40000 Reputation Level)cafelatte User rank is Major (30000 - 40000 Reputation Level)cafelatte User rank is Major (30000 - 40000 Reputation Level)cafelatte User rank is Major (30000 - 40000 Reputation Level) 
Time spent in forums: 1 Month 5 Days 16 h 21 m 8 sec
Reputation Power: 377
The idea of homework is that YOU do it!

Reply With Quote
  #3  
Old October 29th, 2012, 11:33 AM
siddardhab siddardhab is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2012
Posts: 2 siddardhab User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 40 m 20 sec
Reputation Power: 0
This is a practice problem,but you are right,you have no reason to believe me.Can you atleast point me in the right direction regarding the second part of the query.Here is what i did for the first part.

Code:
SELECT fname,lname,B.id FROM
customers A INNER JOIN depositors D on A.id=D.cid INNER JOIN accounts C on D.account_number=C.account_number INNER JOIN branches B ON C.branch_id=B.id
WHERE C.balance>(SELECT AVG(balance) FROM accounts)


I have no idea on how to select branches with the same state as the customer

Reply With Quote
Reply

Viewing: Dev Shed ForumsDatabasesMySQL Help > Need help with this query

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap