Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

How to get DISTINCT on a single column

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
View previous topic :: :: View next topic  
Author Message
brganeshbabu

New User


Joined: 23 Jun 2005
Posts: 34
Location: Chennai

PostPosted: Mon Jul 02, 2007 8:11 pm    Post subject: How to get DISTINCT on a single column
Reply with quote

I have a query which fetches around 10 fields. I am using DISTINCT in the query, even then I get duplicate rows as the DISTINCT is based on the whole record. Is it possible to use DISTINCT on a single column.

The query looks like....
SELECT DISTINCT FIELD1, FIELD2,FIELD3,FIELD4.... FIELD10 FROM
TABLE1,.... TABLE4 WHERE <SOME CONDITION>

The above query fetches many duplicate rows which has similar field values except for the FIELD10
Back to top
View user's profile Send private message

dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Mon Jul 09, 2007 6:28 am    Post subject:
Reply with quote

Hello,

If you will post some sample rows of data and how you want your query to work (the results from using those sample rows as input), we may be able to offer suggestoins.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2 All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Loading data to table gives wrong for... Raghu navaikulam DB2 19 Thu Jul 13, 2017 2:11 pm
This topic is locked: you cannot edit posts or make replies. SDSF multiple spool datasets extracte... PJAlarcon CLIST & REXX 1 Fri Apr 21, 2017 10:50 pm
No new posts Data replication from multiple Db2 ta... kishpra DB2 9 Mon Mar 27, 2017 9:58 pm
No new posts Splitting of single report to seperat... abdulrafi TSO/ISPF 7 Mon Mar 27, 2017 3:59 pm
No new posts Append data from two files into a sin... Praveen04 DFSORT/ICETOOL 5 Thu Mar 16, 2017 7:29 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us