permaculture playing cards*
The moose likes Oracle/OAS and the fly likes Distinct values from multiple rows and columns Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Oracle/OAS
Bookmark "Distinct values from multiple rows and columns" Watch "Distinct values from multiple rows and columns" New topic
Author

Distinct values from multiple rows and columns

Kunal Lakhani
Ranch Hand

Joined: Jun 05, 2010
Posts: 622
i have a table named transport, which has 5 stoppage columns, namely, stoppage1,stoppage2,stoppage3,stoppage4,stoppage5

I need to get distinct values among all rows and columns.

Here is what i did :


This returns me

STOPS
A
B
C
a
D
c

According to requirement, i need the following output (only distinct values regardless of case) :

STOPS
A/a (any of two)
B
C/c (any of two)
D

kunal
Martin Vajsar
Sheriff

Joined: Aug 22, 2010
Posts: 3610
    
  60

Use the UPPER function to convert all values to uppercase.
Kunal Lakhani
Ranch Hand

Joined: Jun 05, 2010
Posts: 622
Thanks for your reply Martin Vajsar.
I used INITCAP function.
Martin Vajsar
Sheriff

Joined: Aug 22, 2010
Posts: 3610
    
  60

Kunal Lakhani wrote:Thanks for your reply Martin Vajsar.
I used INITCAP function.

You're welcome.

It is up to you to decide which records should be considered identical and which different. INITCAP does something different than UPPER, but if INITCAP meets your criteria, so be it. Using INITCAP to define uniqueness seems a bit strange to me, though (you're disregarding only the case of letters at the beginning of words, that looks quite arbitrary to me).
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Distinct values from multiple rows and columns