• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Cannot group third column (Querying)

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am doing a query to find the total number of staff at each football stadium and their managers. So far I am able to output the total number of staff for each stadium, however i need to show the manager as well for each stadium. Can someone help me on this, as i don't know how to include the manager. The manager is in a table called stadium under column "manager_no".

My code:

 
Sheriff
Posts: 3837
66
Netbeans IDE Oracle Firefox Browser
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It would be easy if the manager_no column would be in the same table, right?

SQL has an operation to select columns from several tables and handle them together. That operation is called a "join". There are lots of tutorials that pop out from Google when you search for one (good search keywords might include "sql", "join" and "tutorial"). Try it out and let us know how you're doing.
 
Greenhorn
Posts: 3
Oracle Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It's hard to say without seeing the schema of your database, but if there's only 1 manager per stadium, you can add the manager to the query and add it to the "group by" clause.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic