This week's book giveaway is in the Cloud/Virtualizaton forum.
We're giving away four copies of Mesos in Action and have Roger Ignazio on-line!
See this thread for details.
Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

SQL SELECT DISTINCT

 
Adam Shirley
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a servlet that accesses a datafile, performs a query, and retrieves the information from it. Here is what the select string currently looks like:

SELECT tdydno, tdload, tltype, tlacctno, taname, tlcymd, tlamount, tdstatus, tdsrn

I want to perform a SELECT DISTINCT on tdload. That is, I do not want the same load number displayed twice. It's okay if everything else is displayed twice, just not tdload. Using the keyword DISTINCT here automatically tries to apply it to all of the other words, I think. Is there a way around this?
 
Srikanth Basa
Ranch Hand
Posts: 241
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I believe you are looking for Group By ?
 
Kevin Smither
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, you can use GROUP BY but in this case you have to supply aggregate functions for the other columns
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic