Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes 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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic