Win a copy of Java Mock Exams (software) this week in the Programmer Certification (OCPJP) forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Stripping duplicate data from a join query

 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The project we are going to be writing will be accessed over the internet and we want to send as little data from the data server to the client PC as possible. What have other people done when getting information from a join query where there is a one-to-many relationship? Example: I want all the orders for a list of clients and I need the clients name and address from the client table and all the orders for each client from the orders table. Is there a way to just pass back the client name and address once but get all of their orders? In a normal SQL select statement, the resultset will give me the client name and address on each record which will be a lot of extra information I don't need.
 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try using a GROUP BY clause in your query.
 
Happiness is not a goal ... it's a by-product of a life well lived - Eleanor Roosevelt. Tiny ad:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!